libyang CHANGE rename ambiguous lyp_ prefixed functions and structures

The 'p' in the lyp_ prefix is not unique since it may refer to printer
as well as parser. Some of the objects are connected with libyang output
object, so they are now prefixed by 'ly_out_' prefix. The rest
(lyp_print() or lyp_write()) is so generic that only the `ly_` prefix
can be used for them.
diff --git a/src/printer.c b/src/printer.c
index 6a70cdf..0c10bfc 100644
--- a/src/printer.c
+++ b/src/printer.c
@@ -120,7 +120,7 @@
             }
         }
     } else if ((node->flags & LYD_DEFAULT) && !(options & LYDP_WD_MASK) && !(node->schema->flags & LYS_CONFIG_R)) {
-        /* LYP_WD_EXPLICIT
+        /* LYDP_WD_EXPLICIT
          * - print only if it contains status data in its subtree */
         LYD_TREE_DFS_BEGIN(node, next, elem) {
             if (elem->schema->flags & LYS_CONFIG_R) {
@@ -144,33 +144,33 @@
     return 1;
 }
 
-API LYP_OUT_TYPE
-lyp_out_type(const struct lyp_out *out)
+API LY_OUT_TYPE
+ly_out_type(const struct ly_out *out)
 {
-    LY_CHECK_ARG_RET(NULL, out, LYP_OUT_ERROR);
+    LY_CHECK_ARG_RET(NULL, out, LY_OUT_ERROR);
     return out->type;
 }
 
-API struct lyp_out *
-lyp_new_clb(ssize_t (*writeclb)(void *arg, const void *buf, size_t count), void *arg)
+API struct ly_out *
+ly_out_new_clb(ssize_t (*writeclb)(void *arg, const void *buf, size_t count), void *arg)
 {
-    struct lyp_out *out;
+    struct ly_out *out;
 
     out = calloc(1, sizeof *out);
     LY_CHECK_ERR_RET(!out, LOGMEM(NULL), NULL);
 
-    out->type = LYP_OUT_CALLBACK;
+    out->type = LY_OUT_CALLBACK;
     out->method.clb.func = writeclb;
     out->method.clb.arg = arg;
 
     return out;
 }
 
-API ssize_t (*lyp_clb(struct lyp_out *out, ssize_t (*writeclb)(void *arg, const void *buf, size_t count)))(void *arg, const void *buf, size_t count)
+API ssize_t (*ly_out_clb(struct ly_out *out, ssize_t (*writeclb)(void *arg, const void *buf, size_t count)))(void *arg, const void *buf, size_t count)
 {
     void *prev_clb;
 
-    LY_CHECK_ARG_RET(NULL, out, out->type == LYP_OUT_CALLBACK, NULL);
+    LY_CHECK_ARG_RET(NULL, out, out->type == LY_OUT_CALLBACK, NULL);
 
     prev_clb = out->method.clb.func;
 
@@ -182,11 +182,11 @@
 }
 
 API void *
-lyp_clb_arg(struct lyp_out *out, void *arg)
+ly_out_clb_arg(struct ly_out *out, void *arg)
 {
     void *prev_arg;
 
-    LY_CHECK_ARG_RET(NULL, out, out->type == LYP_OUT_CALLBACK, NULL);
+    LY_CHECK_ARG_RET(NULL, out, out->type == LY_OUT_CALLBACK, NULL);
 
     prev_arg = out->method.clb.arg;
 
@@ -197,21 +197,21 @@
     return prev_arg;
 }
 
-API struct lyp_out *
-lyp_new_fd(int fd)
+API struct ly_out *
+ly_out_new_fd(int fd)
 {
-    struct lyp_out *out;
+    struct ly_out *out;
 
     out = calloc(1, sizeof *out);
     LY_CHECK_ERR_RET(!out, LOGMEM(NULL), NULL);
 
 #ifdef HAVE_VDPRINTF
-    out->type = LYP_OUT_FD;
+    out->type = LY_OUT_FD;
     out->method.fd = fd;
 #else
     /* Without vdfprintf(), change the printing method to printing to a FILE stream.
      * To preserve the original file descriptor, duplicate it and use it to open file stream. */
-    out->type = LYP_OUT_FDSTREAM;
+    out->type = LY_OUT_FDSTREAM;
     out->method.fdstream.fd = fd;
 
     fd = dup(out->method.fdstream.fd);
@@ -235,21 +235,21 @@
 }
 
 API int
-lyp_fd(struct lyp_out *out, int fd)
+ly_out_fd(struct ly_out *out, int fd)
 {
     int prev_fd;
 
-    LY_CHECK_ARG_RET(NULL, out, out->type <= LYP_OUT_FDSTREAM, -1);
+    LY_CHECK_ARG_RET(NULL, out, out->type <= LY_OUT_FDSTREAM, -1);
 
-    if (out->type == LYP_OUT_FDSTREAM) {
+    if (out->type == LY_OUT_FDSTREAM) {
         prev_fd = out->method.fdstream.fd;
-    } else { /* LYP_OUT_FD */
+    } else { /* LY_OUT_FD */
         prev_fd = out->method.fd;
     }
 
     if (fd != -1) {
         /* replace output stream */
-        if (out->type == LYP_OUT_FDSTREAM) {
+        if (out->type == LY_OUT_FDSTREAM) {
             int streamfd;
             FILE *stream;
 
@@ -268,7 +268,7 @@
             fclose(out->method.fdstream.f);
             out->method.fdstream.f = stream;
             out->method.fdstream.fd = streamfd;
-        } else { /* LYP_OUT_FD */
+        } else { /* LY_OUT_FD */
             out->method.fd = fd;
         }
     }
@@ -276,26 +276,26 @@
     return prev_fd;
 }
 
-API struct lyp_out *
-lyp_new_file(FILE *f)
+API struct ly_out *
+ly_out_new_file(FILE *f)
 {
-    struct lyp_out *out;
+    struct ly_out *out;
 
     out = calloc(1, sizeof *out);
     LY_CHECK_ERR_RET(!out, LOGMEM(NULL), NULL);
 
-    out->type = LYP_OUT_FILE;
+    out->type = LY_OUT_FILE;
     out->method.f = f;
 
     return out;
 }
 
 API FILE *
-lyp_file(struct lyp_out *out, FILE *f)
+ly_out_file(struct ly_out *out, FILE *f)
 {
     FILE *prev_f;
 
-    LY_CHECK_ARG_RET(NULL, out, out->type == LYP_OUT_FILE, NULL);
+    LY_CHECK_ARG_RET(NULL, out, out->type == LY_OUT_FILE, NULL);
 
     prev_f = out->method.f;
 
@@ -306,15 +306,15 @@
     return prev_f;
 }
 
-API struct lyp_out *
-lyp_new_memory(char **strp, size_t size)
+API struct ly_out *
+ly_out_new_memory(char **strp, size_t size)
 {
-    struct lyp_out *out;
+    struct ly_out *out;
 
     out = calloc(1, sizeof *out);
     LY_CHECK_ERR_RET(!out, LOGMEM(NULL), NULL);
 
-    out->type = LYP_OUT_MEMORY;
+    out->type = LY_OUT_MEMORY;
     out->method.mem.buf = strp;
     if (!size) {
         /* buffer is supposed to be allocated */
@@ -328,11 +328,11 @@
 }
 
 char *
-lyp_memory(struct lyp_out *out, char **strp, size_t size)
+ly_out_memory(struct ly_out *out, char **strp, size_t size)
 {
     char *data;
 
-    LY_CHECK_ARG_RET(NULL, out, out->type == LYP_OUT_MEMORY, NULL);
+    LY_CHECK_ARG_RET(NULL, out, out->type == LY_OUT_MEMORY, NULL);
 
     data = *out->method.mem.buf;
 
@@ -353,33 +353,33 @@
 }
 
 API LY_ERR
-lyp_out_reset(struct lyp_out *out)
+ly_out_reset(struct ly_out *out)
 {
     LY_CHECK_ARG_RET(NULL, out, LY_EINVAL);
 
     switch(out->type) {
-    case LYP_OUT_ERROR:
+    case LY_OUT_ERROR:
         LOGINT(NULL);
         return LY_EINT;
-    case LYP_OUT_FD:
+    case LY_OUT_FD:
         if ((lseek(out->method.fd, 0, SEEK_SET) == -1) && errno != ESPIPE) {
             LOGERR(NULL, LY_ESYS, "Seeking output file descriptor failed (%s).", strerror(errno));
             return LY_ESYS;
         }
         break;
-    case LYP_OUT_FDSTREAM:
-    case LYP_OUT_FILE:
-    case LYP_OUT_FILEPATH:
+    case LY_OUT_FDSTREAM:
+    case LY_OUT_FILE:
+    case LY_OUT_FILEPATH:
         if ((fseek(out->method.f, 0, SEEK_SET) == -1) && errno != ESPIPE) {
             LOGERR(NULL, LY_ESYS, "Seeking output file stream failed (%s).", strerror(errno));
             return LY_ESYS;
         }
         break;
-    case LYP_OUT_MEMORY:
+    case LY_OUT_MEMORY:
         out->printed = 0;
         out->method.mem.len = 0;
         break;
-    case LYP_OUT_CALLBACK:
+    case LY_OUT_CALLBACK:
         /* nothing to do (not seekable) */
         break;
     }
@@ -387,15 +387,15 @@
     return LY_SUCCESS;
 }
 
-API struct lyp_out *
-lyp_new_filepath(const char *filepath)
+API struct ly_out *
+ly_out_new_filepath(const char *filepath)
 {
-    struct lyp_out *out;
+    struct ly_out *out;
 
     out = calloc(1, sizeof *out);
     LY_CHECK_ERR_RET(!out, LOGMEM(NULL), NULL);
 
-    out->type = LYP_OUT_FILEPATH;
+    out->type = LY_OUT_FILEPATH;
     out->method.fpath.f = fopen(filepath, "w");
     if (!out->method.fpath.f) {
         LOGERR(NULL, LY_ESYS, "Failed to open file \"%s\" (%s).", filepath, strerror(errno));
@@ -406,11 +406,11 @@
 }
 
 API const char *
-lyp_filepath(struct lyp_out *out, const char *filepath)
+ly_out_filepath(struct ly_out *out, const char *filepath)
 {
     FILE *f;
 
-    LY_CHECK_ARG_RET(NULL, out, out->type == LYP_OUT_FILEPATH, filepath ? NULL : ((void *)-1));
+    LY_CHECK_ARG_RET(NULL, out, out->type == LY_OUT_FILEPATH, filepath ? NULL : ((void *)-1));
 
     if (!filepath) {
         return out->method.fpath.filepath;
@@ -432,53 +432,53 @@
 }
 
 API void
-lyp_free(struct lyp_out *out, void (*clb_arg_destructor)(void *arg), int destroy)
+ly_out_free(struct ly_out *out, void (*clb_arg_destructor)(void *arg), int destroy)
 {
     if (!out) {
         return;
     }
 
     switch (out->type) {
-    case LYP_OUT_CALLBACK:
+    case LY_OUT_CALLBACK:
         if (clb_arg_destructor) {
             clb_arg_destructor(out->method.clb.arg);
         }
         break;
-    case LYP_OUT_FDSTREAM:
+    case LY_OUT_FDSTREAM:
         fclose(out->method.fdstream.f);
         if (destroy) {
             close(out->method.fdstream.fd);
         }
         break;
-    case LYP_OUT_FD:
+    case LY_OUT_FD:
         if (destroy) {
             close(out->method.fd);
         }
         break;
-    case LYP_OUT_FILE:
+    case LY_OUT_FILE:
         if (destroy) {
             fclose(out->method.f);
         }
         break;
-    case LYP_OUT_MEMORY:
+    case LY_OUT_MEMORY:
         if (destroy) {
             free(*out->method.mem.buf);
         }
         break;
-    case LYP_OUT_FILEPATH:
+    case LY_OUT_FILEPATH:
         free(out->method.fpath.filepath);
         if (destroy) {
             fclose(out->method.fpath.f);
         }
         break;
-    case LYP_OUT_ERROR:
+    case LY_OUT_ERROR:
         LOGINT(NULL);
     }
     free(out);
 }
 
 API LY_ERR
-lyp_print(struct lyp_out *out, const char *format, ...)
+ly_print(struct ly_out *out, const char *format, ...)
 {
     int count = 0;
     char *msg = NULL, *aux;
@@ -489,21 +489,21 @@
     va_start(ap, format);
 
     switch (out->type) {
-    case LYP_OUT_FD:
+    case LY_OUT_FD:
 #ifdef HAVE_VDPRINTF
         count = vdprintf(out->method.fd, format, ap);
         break;
 #else
-        /* never should be here since lyp_fd() is supposed to set type to LYP_OUT_FDSTREAM in case vdprintf() is missing */
+        /* never should be here since ly_out_fd() is supposed to set type to LY_OUT_FDSTREAM in case vdprintf() is missing */
         LOGINT(NULL);
         return LY_EINT;
 #endif
-    case LYP_OUT_FDSTREAM:
-    case LYP_OUT_FILEPATH:
-    case LYP_OUT_FILE:
+    case LY_OUT_FDSTREAM:
+    case LY_OUT_FILEPATH:
+    case LY_OUT_FILE:
         count = vfprintf(out->method.f, format, ap);
         break;
-    case LYP_OUT_MEMORY:
+    case LY_OUT_MEMORY:
         if ((count = vasprintf(&msg, format, ap)) < 0) {
             break;
         }
@@ -525,14 +525,14 @@
         (*out->method.mem.buf)[out->method.mem.len] = '\0';
         free(msg);
         break;
-    case LYP_OUT_CALLBACK:
+    case LY_OUT_CALLBACK:
         if ((count = vasprintf(&msg, format, ap)) < 0) {
             break;
         }
         count = out->method.clb.func(out->method.clb.arg, msg, count);
         free(msg);
         break;
-    case LYP_OUT_ERROR:
+    case LY_OUT_ERROR:
         LOGINT(NULL);
     }
 
@@ -543,7 +543,7 @@
         out->status = LY_ESYS;
         return LY_ESYS;
     } else {
-        if (out->type == LYP_OUT_FDSTREAM) {
+        if (out->type == LY_OUT_FDSTREAM) {
             /* move the original file descriptor to the end of the output file */
             lseek(out->method.fdstream.fd, 0, SEEK_END);
         }
@@ -553,26 +553,26 @@
 }
 
 void
-ly_print_flush(struct lyp_out *out)
+ly_print_flush(struct ly_out *out)
 {
     switch (out->type) {
-    case LYP_OUT_FDSTREAM:
+    case LY_OUT_FDSTREAM:
         /* move the original file descriptor to the end of the output file */
         lseek(out->method.fdstream.fd, 0, SEEK_END);
         fflush(out->method.fdstream.f);
         break;
-    case LYP_OUT_FILEPATH:
-    case LYP_OUT_FILE:
+    case LY_OUT_FILEPATH:
+    case LY_OUT_FILE:
         fflush(out->method.f);
         break;
-    case LYP_OUT_FD:
+    case LY_OUT_FD:
         fsync(out->method.fd);
         break;
-    case LYP_OUT_MEMORY:
-    case LYP_OUT_CALLBACK:
+    case LY_OUT_MEMORY:
+    case LY_OUT_CALLBACK:
         /* nothing to do */
         break;
-    case LYP_OUT_ERROR:
+    case LY_OUT_ERROR:
         LOGINT(NULL);
     }
 
@@ -581,7 +581,7 @@
 }
 
 API LY_ERR
-lyp_write(struct lyp_out *out, const char *buf, size_t len)
+ly_write(struct ly_out *out, const char *buf, size_t len)
 {
     int written = 0;
 
@@ -606,7 +606,7 @@
 
 repeat:
     switch (out->type) {
-    case LYP_OUT_MEMORY:
+    case LY_OUT_MEMORY:
         if (out->method.mem.len + len + 1 > out->method.mem.size) {
             *out->method.mem.buf = ly_realloc(*out->method.mem.buf, out->method.mem.len + len + 1);
             if (!*out->method.mem.buf) {
@@ -622,18 +622,18 @@
 
         out->printed += len;
         return LY_SUCCESS;
-    case LYP_OUT_FD:
+    case LY_OUT_FD:
         written = write(out->method.fd, buf, len);
         break;
-    case LYP_OUT_FDSTREAM:
-    case LYP_OUT_FILEPATH:
-    case LYP_OUT_FILE:
+    case LY_OUT_FDSTREAM:
+    case LY_OUT_FILEPATH:
+    case LY_OUT_FILE:
         written =  fwrite(buf, sizeof *buf, len, out->method.f);
         break;
-    case LYP_OUT_CALLBACK:
+    case LY_OUT_CALLBACK:
         written = out->method.clb.func(out->method.clb.arg, buf, len);
         break;
-    case LYP_OUT_ERROR:
+    case LY_OUT_ERROR:
         LOGINT(NULL);
     }
 
@@ -649,7 +649,7 @@
         out->status = LY_ESYS;
         return LY_ESYS;
     } else {
-        if (out->type == LYP_OUT_FDSTREAM) {
+        if (out->type == LY_OUT_FDSTREAM) {
             /* move the original file descriptor to the end of the output file */
             lseek(out->method.fdstream.fd, 0, SEEK_END);
         }
@@ -659,12 +659,12 @@
 }
 
 LY_ERR
-ly_write_skip(struct lyp_out *out, size_t count, size_t *position)
+ly_write_skip(struct ly_out *out, size_t count, size_t *position)
 {
     LYOUT_CHECK(out, out->status);
 
     switch (out->type) {
-    case LYP_OUT_MEMORY:
+    case LY_OUT_MEMORY:
         if (out->method.mem.len + count > out->method.mem.size) {
             *out->method.mem.buf = ly_realloc(*out->method.mem.buf, out->method.mem.len + count);
             if (!(*out->method.mem.buf)) {
@@ -685,11 +685,11 @@
         /* update printed bytes counter despite we actually printed just a hole */
         out->printed += count;
         break;
-    case LYP_OUT_FD:
-    case LYP_OUT_FDSTREAM:
-    case LYP_OUT_FILEPATH:
-    case LYP_OUT_FILE:
-    case LYP_OUT_CALLBACK:
+    case LY_OUT_FD:
+    case LY_OUT_FDSTREAM:
+    case LY_OUT_FILEPATH:
+    case LY_OUT_FILE:
+    case LY_OUT_CALLBACK:
         /* buffer the hole */
         if (out->buf_len + count > out->buf_size) {
             out->buffered = ly_realloc(out->buffered, out->buf_len + count);
@@ -712,7 +712,7 @@
         ++out->hole_count;
 
         break;
-    case LYP_OUT_ERROR:
+    case LY_OUT_ERROR:
         LOGINT(NULL);
     }
 
@@ -720,22 +720,22 @@
 }
 
 LY_ERR
-ly_write_skipped(struct lyp_out *out, size_t position, const char *buf, size_t count)
+ly_write_skipped(struct ly_out *out, size_t position, const char *buf, size_t count)
 {
     LY_ERR ret = LY_SUCCESS;
 
     LYOUT_CHECK(out, out->status);
 
     switch (out->type) {
-    case LYP_OUT_MEMORY:
+    case LY_OUT_MEMORY:
         /* write */
         memcpy(&(*out->method.mem.buf)[position], buf, count);
         break;
-    case LYP_OUT_FD:
-    case LYP_OUT_FDSTREAM:
-    case LYP_OUT_FILEPATH:
-    case LYP_OUT_FILE:
-    case LYP_OUT_CALLBACK:
+    case LY_OUT_FD:
+    case LY_OUT_FDSTREAM:
+    case LY_OUT_FILEPATH:
+    case LY_OUT_FILE:
+    case LY_OUT_CALLBACK:
         if (out->buf_len < position + count) {
             out->status = LY_ESYS;
             LOGMEM_RET(NULL);
@@ -750,15 +750,15 @@
         if (!out->hole_count) {
             /* all holes filled, we can write the buffer,
              * printed bytes counter is updated by ly_write() */
-            ret = lyp_write(out, out->buffered, out->buf_len);
+            ret = ly_write(out, out->buffered, out->buf_len);
             out->buf_len = 0;
         }
         break;
-    case LYP_OUT_ERROR:
+    case LY_OUT_ERROR:
         LOGINT(NULL);
     }
 
-    if (out->type == LYP_OUT_FILEPATH) {
+    if (out->type == LY_OUT_FILEPATH) {
         /* move the original file descriptor to the end of the output file */
         lseek(out->method.fdstream.fd, 0, SEEK_END);
     }
diff --git a/src/printer.h b/src/printer.h
index 0034132..00d34e3 100644
--- a/src/printer.h
+++ b/src/printer.h
@@ -20,20 +20,20 @@
 /**
  * @brief Printer output structure specifying where the data are printed.
  */
-struct lyp_out;
+struct ly_out;
 
 /**
  * @brief Types of the printer's output
  */
-typedef enum LYP_OUT_TYPE {
-    LYP_OUT_ERROR = -1,  /**< error value to indicate failure of the functions returning LYP_OUT_TYPE */
-    LYP_OUT_FD,          /**< file descriptor printer */
-    LYP_OUT_FDSTREAM,    /**< internal replacement for LYP_OUT_FD in case vdprintf() is not available */
-    LYP_OUT_FILE,        /**< FILE stream printer */
-    LYP_OUT_FILEPATH,    /**< filepath printer */
-    LYP_OUT_MEMORY,      /**< memory printer */
-    LYP_OUT_CALLBACK     /**< callback printer */
-} LYP_OUT_TYPE;
+typedef enum LY_OUT_TYPE {
+    LY_OUT_ERROR = -1,  /**< error value to indicate failure of the functions returning LY_OUT_TYPE */
+    LY_OUT_FD,          /**< file descriptor printer */
+    LY_OUT_FDSTREAM,    /**< internal replacement for LY_OUT_FD in case vdprintf() is not available */
+    LY_OUT_FILE,        /**< FILE stream printer */
+    LY_OUT_FILEPATH,    /**< filepath printer */
+    LY_OUT_MEMORY,      /**< memory printer */
+    LY_OUT_CALLBACK     /**< callback printer */
+} LY_OUT_TYPE;
 
 /**
  * @brief Get output type of the printer handler.
@@ -41,7 +41,7 @@
  * @param[in] out Printer handler.
  * @return Type of the printer's output.
  */
-LYP_OUT_TYPE lyp_out_type(const struct lyp_out *out);
+LY_OUT_TYPE ly_out_type(const struct ly_out *out);
 
 /**
  * @brief Reset the output medium to write from its beginning, so the following printer function will rewrite the current data
@@ -50,13 +50,13 @@
  * Note that in case the underlying output is not seekable (stream referring a pipe/FIFO/socket or the callback output type),
  * nothing actually happens despite the function succeeds. Also note that the medium is not returned to the state it was when
  * the handler was created. For example, file is seeked into the offset zero, not to the offset where it was opened when
- * lyp_new_file() was called.
+ * ly_out_new_file() was called.
  *
  * @param[in] out Printer handler.
  * @return LY_SUCCESS in case of success
  * @return LY_ESYS in case of failure
  */
-LY_ERR lyp_out_reset(struct lyp_out *out);
+LY_ERR ly_out_reset(struct ly_out *out);
 
 /**
  * @brief Create printer handler using callback printer function.
@@ -66,7 +66,7 @@
  * @return NULL in case of memory allocation error.
  * @return Created printer handler supposed to be passed to different ly*_print_*() functions.
  */
-struct lyp_out *lyp_new_clb(ssize_t (*writeclb)(void *arg, const void *buf, size_t count), void *arg);
+struct ly_out *ly_out_new_clb(ssize_t (*writeclb)(void *arg, const void *buf, size_t count), void *arg);
 
 /**
  * @brief Get or reset callback function associated with a callback printer handler.
@@ -75,7 +75,7 @@
  * @param[in] fd Optional value of a new file descriptor for the handler. If -1, only the current file descriptor value is returned.
  * @return Previous value of the file descriptor.
  */
-ssize_t (*lyp_clb(struct lyp_out *out, ssize_t (*writeclb)(void *arg, const void *buf, size_t count)))(void *arg, const void *buf, size_t count);
+ssize_t (*ly_out_clb(struct ly_out *out, ssize_t (*writeclb)(void *arg, const void *buf, size_t count)))(void *arg, const void *buf, size_t count);
 
 /**
  * @brief Get or reset callback function's argument aasociated with a callback printer handler.
@@ -85,7 +85,7 @@
  * If NULL, only the current file descriptor value is returned.
  * @return The previous callback argument.
  */
-void *lyp_clb_arg(struct lyp_out *out, void *arg);
+void *ly_out_clb_arg(struct ly_out *out, void *arg);
 
 /**
  * @brief Create printer handler using file descriptor.
@@ -94,7 +94,7 @@
  * @return NULL in case of error.
  * @return Created printer handler supposed to be passed to different ly*_print_*() functions.
  */
-struct lyp_out *lyp_new_fd(int fd);
+struct ly_out *ly_out_new_fd(int fd);
 
 /**
  * @brief Get or reset file descriptor printer handler.
@@ -104,7 +104,7 @@
  * @return Previous value of the file descriptor. Note that caller is responsible for closing the returned file descriptor in case of setting new descriptor @p fd.
  * @return -1 in case of error when setting up the new file descriptor.
  */
-int lyp_fd(struct lyp_out *out, int fd);
+int ly_out_fd(struct ly_out *out, int fd);
 
 /**
  * @brief Create printer handler using file stream.
@@ -113,7 +113,7 @@
  * @return NULL in case of error.
  * @return Created printer handler supposed to be passed to different ly*_print_*() functions.
  */
-struct lyp_out *lyp_new_file(FILE *f);
+struct ly_out *ly_out_new_file(FILE *f);
 
 /**
  * @brief Get or reset file stream printer handler.
@@ -122,7 +122,7 @@
  * @param[in] f Optional new file stream for the handler. If NULL, only the current file stream is returned.
  * @return Previous file stream of the handler. Note that caller is responsible for closing the returned stream in case of setting new stream @p f.
  */
-FILE *lyp_file(struct lyp_out *out, FILE *f);
+FILE *ly_out_file(struct ly_out *out, FILE *f);
 
 /**
  * @brief Create printer handler using memory to dump data.
@@ -134,18 +134,18 @@
  * @return NULL in case of error.
  * @return Created printer handler supposed to be passed to different ly*_print_*() functions.
  */
-struct lyp_out *lyp_new_memory(char **strp, size_t size);
+struct ly_out *ly_out_new_memory(char **strp, size_t size);
 
 /**
  * @brief Get or change memory where the data are dumped.
  *
  * @param[in] out Printer handler.
- * @param[in] strp A new string pointer to store the resulting data, same rules as in lyp_new_memory() are applied.
+ * @param[in] strp A new string pointer to store the resulting data, same rules as in ly_out_new_memory() are applied.
  * @param[in] size Size of the buffer provided via @p strp. In case it is 0, the buffer for the printed data
  * is newly allocated even if @p strp points to a pointer to an existing buffer.
  * @return Previous dumped data. Note that the caller is responsible to free the data in case of changing string pointer @p strp.
  */
-char *lyp_memory(struct lyp_out *out, char **strp, size_t size);
+char *ly_out_memory(struct ly_out *out, char **strp, size_t size);
 
 /**
  * @brief Create printer handler file of the given filename.
@@ -154,7 +154,7 @@
  * @return NULL in case of error.
  * @return Created printer handler supposed to be passed to different ly*_print_*() functions.
  */
-struct lyp_out *lyp_new_filepath(const char *filepath);
+struct ly_out *ly_out_new_filepath(const char *filepath);
 
 /**
  * @brief Get or change the filepath of the file where the printer prints the data.
@@ -168,23 +168,23 @@
  * @return Previous filepath string in case the @p filepath argument is NULL.
  * @return NULL if changing filepath succeedes and ((void *)-1) otherwise.
  */
-const char *lyp_filepath(struct lyp_out *out, const char *filepath);
+const char *ly_out_filepath(struct ly_out *out, const char *filepath);
 
 /**
  * @brief Generic printer of the given format string into the specified output.
  *
- * Alternatively, lyp_write() can be used.
+ * Alternatively, ly_write() can be used.
  *
  * @param[in] out Output specification.
  * @param[in] format format string to be printed.
  * @return LY_ERR value, number of the printed bytes is updated in lyout::printed.
  */
-LY_ERR lyp_print(struct lyp_out *out, const char *format, ...);
+LY_ERR ly_print(struct ly_out *out, const char *format, ...);
 
 /**
  * @brief Generic printer of the given string buffer into the specified output.
  *
- * Alternatively, lyp_print() can be used.
+ * Alternatively, ly_print() can be used.
  *
  * As an extension for printing holes (skipping some data until they are known),
  * ly_write_skip() and ly_write_skipped() can be used.
@@ -192,17 +192,17 @@
  * @param[in] out Output specification.
  * @param[in] buf Memory buffer with the data to print.
  * @param[in] len Length of the data to print in the @p buf.
- * @return LY_ERR value, number of the printed bytes is updated in lyout::printed.
+ * @return LY_ERR value, number of the printed bytes is updated in ly_out::printed.
  */
-LY_ERR lyp_write(struct lyp_out *out, const char *buf, size_t len);
+LY_ERR ly_write(struct ly_out *out, const char *buf, size_t len);
 
 /**
  * @brief Free the printer handler.
  * @param[in] out Printer handler to free.
- * @param[in] clb_arg_destructor Freeing function for printer callback (LYP_OUT_CALLBACK) argument.
- * @param[in] destroy Flag to free allocated buffer (for LYP_OUT_MEMORY) or to
- * close stream/file descriptor (for LYP_OUT_FD, LYP_OUT_FDSTREAM and LYP_OUT_FILE)
+ * @param[in] clb_arg_destructor Freeing function for printer callback (LY_OUT_CALLBACK) argument.
+ * @param[in] destroy Flag to free allocated buffer (for LY_OUT_MEMORY) or to
+ * close stream/file descriptor (for LY_OUT_FD, LY_OUT_FDSTREAM and LY_OUT_FILE)
  */
-void lyp_free(struct lyp_out *out, void (*clb_arg_destructor)(void *arg), int destroy);
+void ly_out_free(struct ly_out *out, void (*clb_arg_destructor)(void *arg), int destroy);
 
 #endif /* LY_PRINTER_H_ */
diff --git a/src/printer_data.c b/src/printer_data.c
index 96c2109..02f6ede 100644
--- a/src/printer_data.c
+++ b/src/printer_data.c
@@ -31,11 +31,11 @@
  * @param[in] out Prepared structure defining the type and details of the printer output.
  * @param[in] root The root element of the (sub)tree to print.
  * @param[in] format Output format.
- * @param[in] options [Data printer flags](@ref dataprinterflags). With \p format LYD_LYB, only #LYP_WITHSIBLINGS option is accepted.
+ * @param[in] options [Data printer flags](@ref dataprinterflags). With \p format LYD_LYB, only #LYDP_WITHSIBLINGS option is accepted.
  * @return LY_ERR value.
  */
 API ssize_t
-lyd_print(struct lyp_out *out, const struct lyd_node *root, LYD_FORMAT format, int options)
+lyd_print(struct ly_out *out, const struct lyd_node *root, LYD_FORMAT format, int options)
 {
     LY_ERR ret;
     size_t printed_prev;
diff --git a/src/printer_data.h b/src/printer_data.h
index 921793f..d9065bb 100644
--- a/src/printer_data.h
+++ b/src/printer_data.h
@@ -37,12 +37,12 @@
                                       Note that this is the default value when no WD option is specified. */
 #define LYDP_WD_TRIM       0x10  /**< Do not print the nodes with the value equal to their default value */
 #define LYDP_WD_ALL        0x20  /**< Include implicit default nodes */
-#define LYDP_WD_ALL_TAG    0x40  /**< Same as #LYP_WD_ALL but also adds attribute 'default' with value 'true' to
+#define LYDP_WD_ALL_TAG    0x40  /**< Same as #LYDP_WD_ALL but also adds attribute 'default' with value 'true' to
                                       all nodes that has its default value. The 'default' attribute has namespace:
                                       urn:ietf:params:xml:ns:netconf:default:1.0 and thus the attributes are
                                       printed only when the ietf-netconf-with-defaults module is present in libyang
                                       context (but in that case this namespace is always printed). */
-#define LYDP_WD_IMPL_TAG   0x80  /**< Same as LYP_WD_ALL_TAG but the attributes are added only to the nodes that
+#define LYDP_WD_IMPL_TAG   0x80  /**< Same as LYDP_WD_ALL_TAG but the attributes are added only to the nodes that
                                       are not explicitly present in the original data tree despite their
                                       value is equal to their default value.  There is the same limitation regarding
                                       the presence of ietf-netconf-with-defaults module in libyang context. */
@@ -53,13 +53,13 @@
 /**
  * @brief Common YANG data printer.
  *
- * @param[in] out Printer handler for a specific output. Use lyp_*() functions to create the handler and lyp_free() to remove the handler.
+ * @param[in] out Printer handler for a specific output. Use ly_out_*() functions to create and free the handler.
  * @param[in] root The root element of the (sub)tree to print.
  * @param[in] format Output format.
- * @param[in] options [Data printer flags](@ref dataprinterflags). With \p format LYD_LYB, only #LYP_WITHSIBLINGS option is accepted.
+ * @param[in] options [Data printer flags](@ref dataprinterflags). With \p format LYD_LYB, only #LYDP_WITHSIBLINGS option is accepted.
  * @return Number of printed characters (excluding the null byte used to end the string) in case of success.
  * @return Negative value failure (absolute value corresponds to LY_ERR values).
  */
-ssize_t lyd_print(struct lyp_out *out, const struct lyd_node *root, LYD_FORMAT format, int options);
+ssize_t lyd_print(struct ly_out *out, const struct lyd_node *root, LYD_FORMAT format, int options);
 
 #endif /* LY_PRINTER_DATA_H_ */
diff --git a/src/printer_internal.h b/src/printer_internal.h
index f60f6d4..35102b5 100644
--- a/src/printer_internal.h
+++ b/src/printer_internal.h
@@ -22,28 +22,28 @@
 /**
  * @brief Printer output structure specifying where the data are printed.
  */
-struct lyp_out {
-    LYP_OUT_TYPE type;     /**< type of the output to select the output method */
+struct ly_out {
+    LY_OUT_TYPE type;     /**< type of the output to select the output method */
     union {
-        int fd;          /**< file descriptor for LYP_OUT_FD type */
-        FILE *f;         /**< file structure for LYP_OUT_STREAM, LYP_OUT_FDSTREAM and LYP_OUT_FILEPATH types */
+        int fd;          /**< file descriptor for LY_OUT_FD type */
+        FILE *f;         /**< file structure for LY_OUT_FILE, LY_OUT_FDSTREAM and LY_OUT_FILEPATH types */
         struct {
-            FILE *f;          /**< file stream from the original file descriptor, variable is mapped to the LYP_OUT_STREAM's f */
+            FILE *f;          /**< file stream from the original file descriptor, variable is mapped to the LY_OUT_FILE's f */
             int fd;           /**< original file descriptor, which was not used directly because of missing vdprintf() */
-        } fdstream;      /**< structure for LYP_OUT_FDSTREAM type, which is LYP_OUT_FD when vdprintf() is missing */
+        } fdstream;      /**< structure for LY_OUT_FDSTREAM type, which is LY_OUT_FD when vdprintf() is missing */
         struct {
-            FILE *f;          /**< file structure for LYP_OUT_FILEPATH, variable is mapped to the LYP_OUT_STREAM's f */
+            FILE *f;          /**< file structure for LY_OUT_FILEPATH, variable is mapped to the LY_OUT_FILE's f */
             char *filepath;   /**< stored original filepath */
-        } fpath;         /**< filepath structure for LYP_OUT_FILEPATH */
+        } fpath;         /**< filepath structure for LY_OUT_FILEPATH */
         struct {
             char **buf;       /**< storage for the pointer to the memory buffer to store the output */
             size_t len;       /**< number of used bytes in the buffer */
             size_t size;      /**< allocated size of the buffer */
-        } mem;           /**< memory buffer information for LYP_OUT_MEMORY type */
+        } mem;           /**< memory buffer information for LY_OUT_MEMORY type */
         struct {
             ssize_t (*func)(void *arg, const void *buf, size_t count); /**< callback function */
             void *arg;        /**< optional argument for the callback function */
-        } clb;           /**< printer callback for LYP_OUT_CALLBACK type */
+        } clb;           /**< printer callback for LY_OUT_CALLBACK type */
     } method;            /**< type-specific information about the output */
 
     char *buffered;      /**< additional buffer for holes, used only for LYB data format */
@@ -83,7 +83,7 @@
  * @param[in] module Schema to be printed (the parsed member is used).
  * @return LY_ERR value, number of the printed bytes is updated in lyout::printed.
  */
-LY_ERR yang_print_parsed(struct lyp_out *out, const struct lys_module *module);
+LY_ERR yang_print_parsed(struct ly_out *out, const struct lys_module *module);
 
 /**
  * @brief YANG printer of the compiled schemas.
@@ -97,7 +97,7 @@
  * @param[in] options Schema output options (see @ref schemaprinterflags).
  * @return LY_ERR value, number of the printed bytes is updated in lyout::printed.
  */
-LY_ERR yang_print_compiled(struct lyp_out *out, const struct lys_module *module, int options);
+LY_ERR yang_print_compiled(struct ly_out *out, const struct lys_module *module, int options);
 
 /**
  * @brief YANG printer of the compiled schema node
@@ -111,7 +111,7 @@
  * @param[in] options Schema output options (see @ref schemaprinterflags).
  * @return LY_ERR value, number of the printed bytes is updated in lyout::printed.
  */
-LY_ERR yang_print_compiled_node(struct lyp_out *out, const struct lysc_node *node, int options);
+LY_ERR yang_print_compiled_node(struct ly_out *out, const struct lysc_node *node, int options);
 
 /**
  * @brief YIN printer of the parsed schemas. Full YIN printer.
@@ -120,7 +120,7 @@
  * @param[in] module Schema to be printed (the parsed member is used).
  * @return LY_ERR value, number of the printed bytes is updated in lyout::printed.
  */
-LY_ERR yin_print_parsed(struct lyp_out *out, const struct lys_module *module);
+LY_ERR yin_print_parsed(struct ly_out *out, const struct lys_module *module);
 
 /**
  * @brief XML printer of the YANG data.
@@ -130,7 +130,7 @@
  * @param[in] options [Data printer flags](@ref dataprinterflags).
  * @return LY_ERR value, number of the printed bytes is updated in lyout::printed.
  */
-LY_ERR xml_print_data(struct lyp_out *out, const struct lyd_node *root, int options);
+LY_ERR xml_print_data(struct ly_out *out, const struct lyd_node *root, int options);
 
 /**
  * @brief Check whether a node value equals to its default one.
@@ -155,7 +155,7 @@
  * @brief Flush the output from any internal buffers and clean any auxiliary data.
  * @param[in] out Output specification.
  */
-void ly_print_flush(struct lyp_out *out);
+void ly_print_flush(struct ly_out *out);
 
 /**
  * @brief Create a hole in the output data that will be filled later.
@@ -166,7 +166,7 @@
  * @return LY_ERR value. The number of the printed bytes is updated in lyout::printed
  * only in case the data are really written into the output.
  */
-LY_ERR ly_write_skip(struct lyp_out *out, size_t len, size_t *position);
+LY_ERR ly_write_skip(struct ly_out *out, size_t len, size_t *position);
 
 /**
  * @brief Write data into the hole at given position.
@@ -179,6 +179,6 @@
  * @return LY_ERR value. The number of the printed bytes is updated in lyout::printed
  * only in case the data are really written into the output.
  */
-LY_ERR ly_write_skipped(struct lyp_out *out, size_t position, const char *buf, size_t len);
+LY_ERR ly_write_skipped(struct ly_out *out, size_t position, const char *buf, size_t len);
 
 #endif /* LY_PRINTER_INTERNAL_H_ */
diff --git a/src/printer_schema.c b/src/printer_schema.c
index a4cbf1f..3bb26b7 100644
--- a/src/printer_schema.c
+++ b/src/printer_schema.c
@@ -25,7 +25,7 @@
 #include "tree_schema.h"
 
 API ssize_t
-lys_print(struct lyp_out *out, const struct lys_module *module, LYS_OUTFORMAT format, int UNUSED(line_length), int options)
+lys_print(struct ly_out *out, const struct lys_module *module, LYS_OUTFORMAT format, int UNUSED(line_length), int options)
 {
     LY_ERR ret;
     size_t printed_prev;
@@ -68,7 +68,7 @@
 }
 
 API ssize_t
-lys_print_node(struct lyp_out *out, const struct lysc_node *node, LYS_OUTFORMAT format, int UNUSED(line_length), int options)
+lys_print_node(struct ly_out *out, const struct lysc_node *node, LYS_OUTFORMAT format, int UNUSED(line_length), int options)
 {
     LY_ERR ret;
     size_t printed_prev;
diff --git a/src/printer_schema.h b/src/printer_schema.h
index 1162cc2..e720e96 100644
--- a/src/printer_schema.h
+++ b/src/printer_schema.h
@@ -42,7 +42,7 @@
 /**
  * @brief Schema module printer.
  *
- * @param[in] out Printer handler for a specific output. Use lyp_*() functions to create the handler and lyp_free() to remove the handler.
+ * @param[in] out Printer handler for a specific output. Use ly_out_*() functions to create and free the handler.
  * @param[in] module Schema to print.
  * @param[in] format Output format.
  * @param[in] line_length Maximum characters to be printed on a line, 0 for unlimited. Only for #LYS_OUT_TREE printer.
@@ -50,12 +50,12 @@
  * @return Number of printed bytes in case of success.
  * @return Negative value failure (absolute value corresponds to LY_ERR values).
  */
-ssize_t lys_print(struct lyp_out *out, const struct lys_module *module, LYS_OUTFORMAT format, int line_length, int options);
+ssize_t lys_print(struct ly_out *out, const struct lys_module *module, LYS_OUTFORMAT format, int line_length, int options);
 
 /**
  * @brief Schema node printer.
  *
- * @param[in] out Printer handler for a specific output. Use lyp_*() functions to create the handler and lyp_free() to remove the handler.
+ * @param[in] out Printer handler for a specific output. Use ly_out_*() functions to create and free the handler.
  * @param[in] node Schema node to print, lys_find_node() can be used to get it from a path string.
  * @param[in] format Output format.
  * @param[in] line_length Maximum characters to be printed on a line, 0 for unlimited. Only for #LYS_OUT_TREE printer.
@@ -63,7 +63,7 @@
  * @return Number of printed bytes in case of success.
  * @return Negative value failure (absolute value corresponds to LY_ERR values).
  */
-ssize_t lys_print_node(struct lyp_out *out, const struct lysc_node *node, LYS_OUTFORMAT format, int line_length, int options);
+ssize_t lys_print_node(struct ly_out *out, const struct lysc_node *node, LYS_OUTFORMAT format, int line_length, int options);
 
 /** @} schematree */
 
diff --git a/src/printer_xml.c b/src/printer_xml.c
index b1d187c..2e5182e 100644
--- a/src/printer_xml.c
+++ b/src/printer_xml.c
@@ -32,7 +32,7 @@
  * @brief XML printer context.
  */
 struct xmlpr_ctx {
-    struct lyp_out *out;  /**< output specification */
+    struct ly_out *out;  /**< output specification */
     unsigned int level; /**< current indentation level: 0 - no formatting, >= 1 indentation levels */
     int options;        /**< [Data printer flags](@ref dataprinterflags) */
     const struct ly_ctx *ctx; /**< libyang context */
@@ -89,7 +89,7 @@
 
     if (i == -1) {
         /* suitable namespace not found, must be printed */
-        lyp_print(ctx->out, " xmlns%s%s=\"%s\"", new_prefix ? ":" : "", new_prefix ? new_prefix : "", ns);
+        ly_print(ctx->out, " xmlns%s%s=\"%s\"", new_prefix ? ":" : "", new_prefix ? new_prefix : "", ns);
 
         /* and added into namespaces */
         if (new_prefix) {
@@ -144,7 +144,7 @@
             /* we have implicit OR explicit default node, print attribute only if context include with-defaults schema */
             mod = ly_ctx_get_module_latest(node->schema->module->ctx, "ietf-netconf-with-defaults");
             if (mod) {
-                lyp_print(ctx->out, " %s:default=\"true\"", xml_print_ns(ctx, mod->ns, mod->prefix, 0));
+                ly_print(ctx->out, " %s:default=\"true\"", xml_print_ns(ctx, mod->ns, mod->prefix, 0));
             }
         }
     }
@@ -177,17 +177,17 @@
                 }
 
                 for (i = 0; i < ns_count; ++i) {
-                    lyp_print(out, " xmlns:%s=\"%s\"", prefs[i], nss[i]);
+                    ly_print(out, " xmlns:%s=\"%s\"", prefs[i], nss[i]);
                 }
                 free(prefs);
                 free(nss);
             }
-            lyp_print(out, " %s=\"", meta->name);
+            ly_print(out, " %s=\"", meta->name);
         } else {
 #endif
             /* print the metadata with its namespace */
             mod = meta->annotation->module;
-            lyp_print(ctx->out, " %s:%s=\"", xml_print_ns(ctx, mod->ns, mod->prefix, 1), meta->name);
+            ly_print(ctx->out, " %s:%s=\"", xml_print_ns(ctx, mod->ns, mod->prefix, 1), meta->name);
 #if 0
         }
 #endif
@@ -196,7 +196,7 @@
         if (value && value[0]) {
             lyxml_dump_text(ctx->out, value, 1);
         }
-        lyp_print(ctx->out, "\"");
+        ly_print(ctx->out, "\"");
         if (dynamic) {
             free((void *)value);
         }
@@ -215,7 +215,7 @@
 xml_print_node_open(struct xmlpr_ctx *ctx, const struct lyd_node *node)
 {
     /* print node name */
-    lyp_print(ctx->out, "%*s<%s", INDENT, node->schema->name);
+    ly_print(ctx->out, "%*s<%s", INDENT, node->schema->name);
 
     /* print default namespace */
     xml_print_ns(ctx, node->schema->module->ns, NULL, 0);
@@ -254,7 +254,7 @@
         }
 
         /* print the attribute with its prefix and value */
-        lyp_print(ctx->out, " %s%s%s=\"%s\"", pref ? pref : "", pref ? ":" : "", attr->name, attr->value);
+        ly_print(ctx->out, " %s%s%s=\"%s\"", pref ? pref : "", pref ? ":" : "", attr->name, attr->value);
     }
 
     return LY_SUCCESS;
@@ -264,7 +264,7 @@
 xml_print_opaq_open(struct xmlpr_ctx *ctx, const struct lyd_node_opaq *node)
 {
     /* print node name */
-    lyp_print(ctx->out, "%*s<%s", INDENT, node->name);
+    ly_print(ctx->out, "%*s<%s", INDENT, node->name);
 
     /* print default namespace */
     switch (node->format) {
@@ -305,16 +305,16 @@
     /* print namespaces connected with the values's prefixes */
     for (u = 0; u < ns_list.count; ++u) {
         const struct lys_module *mod = (const struct lys_module *)ns_list.objs[u];
-        lyp_print(ctx->out, " xmlns:%s=\"%s\"", mod->prefix, mod->ns);
+        ly_print(ctx->out, " xmlns:%s=\"%s\"", mod->prefix, mod->ns);
     }
     ly_set_erase(&ns_list, NULL);
 
     if (!value || !value[0]) {
-        lyp_print(ctx->out, "/>%s", LEVEL ? "\n" : "");
+        ly_print(ctx->out, "/>%s", LEVEL ? "\n" : "");
     } else {
-        lyp_print(ctx->out, ">");
+        ly_print(ctx->out, ">");
         lyxml_dump_text(ctx->out, value, 0);
-        lyp_print(ctx->out, "</%s>%s", node->schema->name, LEVEL ? "\n" : "");
+        ly_print(ctx->out, "</%s>%s", node->schema->name, LEVEL ? "\n" : "");
     }
     if (dynamic) {
         free((void *)value);
@@ -337,12 +337,12 @@
     xml_print_node_open(ctx, (struct lyd_node *)node);
 
     if (!node->child) {
-        lyp_print(ctx->out, "/>%s", ctx->level ? "\n" : "");
+        ly_print(ctx->out, "/>%s", ctx->level ? "\n" : "");
         return LY_SUCCESS;
     }
 
     /* children */
-    lyp_print(ctx->out, ">%s", ctx->level ? "\n" : "");
+    ly_print(ctx->out, ">%s", ctx->level ? "\n" : "");
 
     LEVEL_INC;
     LY_LIST_FOR(node->child, child) {
@@ -351,7 +351,7 @@
     }
     LEVEL_DEC;
 
-    lyp_print(ctx->out, "%*s</%s>%s", INDENT, node->schema->name, LEVEL ? "\n" : "");
+    ly_print(ctx->out, "%*s</%s>%s", INDENT, node->schema->name, LEVEL ? "\n" : "");
 
     return LY_SUCCESS;
 }
@@ -369,7 +369,7 @@
     if (!any->value.tree) {
         /* no content */
 no_content:
-        lyp_print(ctx->out, "/>%s", LEVEL ? "\n" : "");
+        ly_print(ctx->out, "/>%s", LEVEL ? "\n" : "");
         return LY_SUCCESS;
     } else {
         switch (any->value_type) {
@@ -379,7 +379,7 @@
             ctx->options &= ~LYDP_WITHSIBLINGS;
             LEVEL_INC;
 
-            lyp_print(ctx->out, ">%s", LEVEL ? "\n" : "");
+            ly_print(ctx->out, ">%s", LEVEL ? "\n" : "");
             LY_LIST_FOR(any->value.tree, iter) {
                 ret = xml_print_node(ctx, iter);
                 LY_CHECK_ERR_RET(ret, LEVEL_DEC, ret);
@@ -394,7 +394,7 @@
                 goto no_content;
             }
             /* close opening tag and print data */
-            lyp_print(ctx->out, ">");
+            ly_print(ctx->out, ">");
             lyxml_dump_text(ctx->out, any->value.str, 0);
             break;
         case LYD_ANYDATA_XML:
@@ -402,7 +402,7 @@
             if (!any->value.str[0]) {
                 goto no_content;
             }
-            lyp_print(ctx->out, ">%s", any->value.str);
+            ly_print(ctx->out, ">%s", any->value.str);
             break;
         case LYD_ANYDATA_JSON:
 #if 0 /* TODO LYB format */
@@ -415,9 +415,9 @@
 
         /* closing tag */
         if (any->value_type == LYD_ANYDATA_DATATREE) {
-            lyp_print(ctx->out, "%*s</%s>%s", INDENT, node->schema->name, LEVEL ? "\n" : "");
+            ly_print(ctx->out, "%*s</%s>%s", INDENT, node->schema->name, LEVEL ? "\n" : "");
         } else {
-            lyp_print(ctx->out, "</%s>%s", node->schema->name, LEVEL ? "\n" : "");
+            ly_print(ctx->out, "</%s>%s", node->schema->name, LEVEL ? "\n" : "");
         }
     }
 
@@ -441,13 +441,13 @@
             }
         }
 
-        lyp_print(ctx->out, ">%s", node->value);
+        ly_print(ctx->out, ">%s", node->value);
     }
 
     if (node->child) {
         /* children */
         if (!node->value[0]) {
-            lyp_print(ctx->out, ">%s", ctx->level ? "\n" : "");
+            ly_print(ctx->out, ">%s", ctx->level ? "\n" : "");
         }
 
         LEVEL_INC;
@@ -457,12 +457,12 @@
         }
         LEVEL_DEC;
 
-        lyp_print(ctx->out, "%*s</%s>%s", INDENT, node->name, LEVEL ? "\n" : "");
+        ly_print(ctx->out, "%*s</%s>%s", INDENT, node->name, LEVEL ? "\n" : "");
     } else if (node->value[0]) {
-        lyp_print(ctx->out, "</%s>%s", node->name, LEVEL ? "\n" : "");
+        ly_print(ctx->out, "</%s>%s", node->name, LEVEL ? "\n" : "");
     } else {
         /* no value or children */
-        lyp_print(ctx->out, "/>%s", ctx->level ? "\n" : "");
+        ly_print(ctx->out, "/>%s", ctx->level ? "\n" : "");
     }
 
     return LY_SUCCESS;
@@ -526,14 +526,14 @@
 }
 
 LY_ERR
-xml_print_data(struct lyp_out *out, const struct lyd_node *root, int options)
+xml_print_data(struct ly_out *out, const struct lyd_node *root, int options)
 {
     const struct lyd_node *node;
     struct xmlpr_ctx ctx = {0};
 
     if (!root) {
-        if (out->type == LYP_OUT_MEMORY || out->type == LYP_OUT_CALLBACK) {
-            lyp_print(out, "");
+        if (out->type == LY_OUT_MEMORY || out->type == LY_OUT_CALLBACK) {
+            ly_print(out, "");
         }
         goto finish;
     }
diff --git a/src/printer_yang.c b/src/printer_yang.c
index 43d3833..51bc997 100755
--- a/src/printer_yang.c
+++ b/src/printer_yang.c
@@ -41,7 +41,7 @@
  * @brief YANG printer context.
  */
 struct ypr_ctx {
-    struct lyp_out *out;               /**< output specification */
+    struct ly_out *out;               /**< output specification */
     unsigned int level;              /**< current indentation level: 0 - no formatting, >= 1 indentation levels */
     const struct lys_module *module; /**< schema to print */
     enum schema_type schema;         /**< type of the schema to print */
@@ -64,7 +64,7 @@
  * the @p text is printed completely as a NULL-terminated string.
  */
 static void
-ypr_encode(struct lyp_out *out, const char *text, int len)
+ypr_encode(struct ly_out *out, const char *text, int len)
 {
     int i, start_len;
     const char *start;
@@ -94,19 +94,19 @@
         }
 
         if (special) {
-            lyp_write(out, start, start_len);
+            ly_write(out, start, start_len);
             switch (special) {
             case '\n':
-                lyp_write(out, "\\n", 2);
+                ly_write(out, "\\n", 2);
                 break;
             case '\t':
-                lyp_write(out, "\\t", 2);
+                ly_write(out, "\\t", 2);
                 break;
             case '\"':
-                lyp_write(out, "\\\"", 2);
+                ly_write(out, "\\\"", 2);
                 break;
             case '\\':
-                lyp_write(out, "\\\\", 2);
+                ly_write(out, "\\\\", 2);
                 break;
             }
 
@@ -117,15 +117,15 @@
         }
     }
 
-    lyp_write(out, start, start_len);
+    ly_write(out, start, start_len);
 }
 
 static void
-ypr_open(struct lyp_out *out, int *flag)
+ypr_open(struct ly_out *out, int *flag)
 {
     if (flag && !*flag) {
         *flag = 1;
-        lyp_print(out, " {\n");
+        ly_print(out, " {\n");
     }
 }
 
@@ -133,9 +133,9 @@
 ypr_close(struct ypr_ctx *ctx, int flag)
 {
     if (flag) {
-        lyp_print(ctx->out, "%*s}\n", INDENT);
+        ly_print(ctx->out, "%*s}\n", INDENT);
     } else {
-        lyp_print(ctx->out, ";\n");
+        ly_print(ctx->out, ";\n");
     }
 }
 
@@ -145,28 +145,28 @@
     const char *s, *t;
 
     if (singleline) {
-        lyp_print(ctx->out, "%*s%s \"", INDENT, name);
+        ly_print(ctx->out, "%*s%s \"", INDENT, name);
     } else {
-        lyp_print(ctx->out, "%*s%s\n", INDENT, name);
+        ly_print(ctx->out, "%*s%s\n", INDENT, name);
         LEVEL++;
 
-        lyp_print(ctx->out, "%*s\"", INDENT);
+        ly_print(ctx->out, "%*s\"", INDENT);
     }
     t = text;
     while ((s = strchr(t, '\n'))) {
         ypr_encode(ctx->out, t, s - t);
-        lyp_print(ctx->out, "\n");
+        ly_print(ctx->out, "\n");
         t = s + 1;
         if (*t != '\n') {
-            lyp_print(ctx->out, "%*s ", INDENT);
+            ly_print(ctx->out, "%*s ", INDENT);
         }
     }
 
     ypr_encode(ctx->out, t, strlen(t));
     if (closed) {
-        lyp_print(ctx->out, "\";\n");
+        ly_print(ctx->out, "\";\n");
     } else {
-        lyp_print(ctx->out, "\"");
+        ly_print(ctx->out, "\"");
     }
     if (!singleline) {
         LEVEL--;
@@ -181,26 +181,26 @@
 
     if (stmt->arg) {
         if (stmt->flags) {
-            lyp_print(ctx->out, "%*s%s\n", INDENT, stmt->stmt);
+            ly_print(ctx->out, "%*s%s\n", INDENT, stmt->stmt);
             LEVEL++;
-            lyp_print(ctx->out, "%*s%c", INDENT, (stmt->flags & LYS_DOUBLEQUOTED) ? '\"' : '\'');
+            ly_print(ctx->out, "%*s%c", INDENT, (stmt->flags & LYS_DOUBLEQUOTED) ? '\"' : '\'');
             t = stmt->arg;
             while ((s = strchr(t, '\n'))) {
                 ypr_encode(ctx->out, t, s - t);
-                lyp_print(ctx->out, "\n");
+                ly_print(ctx->out, "\n");
                 t = s + 1;
                 if (*t != '\n') {
-                    lyp_print(ctx->out, "%*s ", INDENT);
+                    ly_print(ctx->out, "%*s ", INDENT);
                 }
             }
             LEVEL--;
             ypr_encode(ctx->out, t, strlen(t));
-            lyp_print(ctx->out, "%c%s", (stmt->flags & LYS_DOUBLEQUOTED) ? '\"' : '\'', stmt->child ? " {\n" : ";\n");
+            ly_print(ctx->out, "%c%s", (stmt->flags & LYS_DOUBLEQUOTED) ? '\"' : '\'', stmt->child ? " {\n" : ";\n");
         } else {
-            lyp_print(ctx->out, "%*s%s %s%s", INDENT, stmt->stmt, stmt->arg, stmt->child ? " {\n" : ";\n");
+            ly_print(ctx->out, "%*s%s %s%s", INDENT, stmt->stmt, stmt->arg, stmt->child ? " {\n" : ";\n");
         }
     } else {
-        lyp_print(ctx->out, "%*s%s%s", INDENT, stmt->stmt, stmt->child ? " {\n" : ";\n");
+        ly_print(ctx->out, "%*s%s%s", INDENT, stmt->stmt, stmt->child ? " {\n" : ";\n");
     }
 
     if (stmt->child) {
@@ -209,7 +209,7 @@
             yprp_stmt(ctx, childstmt);
         }
         LEVEL--;
-        lyp_print(ctx->out, "%*s}\n", INDENT);
+        ly_print(ctx->out, "%*s}\n", INDENT);
     }
 }
 
@@ -239,7 +239,7 @@
         }
 
         if (!ext->compiled && ext->yin) {
-            lyp_print(ctx->out, "%*s%s; // Model comes from different input format, extensions must be resolved first.\n", INDENT, ext[u].name);
+            ly_print(ctx->out, "%*s%s; // Model comes from different input format, extensions must be resolved first.\n", INDENT, ext[u].name);
             continue;
         }
 
@@ -252,11 +252,11 @@
             argument = ext[u].argument;
         }
         if (argument) {
-            lyp_print(ctx->out, "%*s%s \"", INDENT, ext[u].name);
+            ly_print(ctx->out, "%*s%s \"", INDENT, ext[u].name);
             ypr_encode(ctx->out, argument, -1);
-            lyp_print(ctx->out, "\"");
+            ly_print(ctx->out, "\"");
         } else {
-            lyp_print(ctx->out, "%*s%s", INDENT, ext[u].name);
+            ly_print(ctx->out, "%*s%s", INDENT, ext[u].name);
         }
 
         child_presence = 0;
@@ -266,16 +266,16 @@
                 continue;
             }
             if (!child_presence) {
-                lyp_print(ctx->out, " {\n");
+                ly_print(ctx->out, " {\n");
                 child_presence = 1;
             }
             yprp_stmt(ctx, stmt);
         }
         LEVEL--;
         if (child_presence) {
-            lyp_print(ctx->out, "%*s}\n", INDENT);
+            ly_print(ctx->out, "%*s}\n", INDENT);
         } else {
-            lyp_print(ctx->out, ";\n");
+            ly_print(ctx->out, ";\n");
         }
     }
 }
@@ -318,7 +318,7 @@
     }
 
     if (ext_substmt_info[substmt].flags & SUBST_FLAG_ID) {
-        lyp_print(ctx->out, "%*s%s %s", INDENT, ext_substmt_info[substmt].name, text);
+        ly_print(ctx->out, "%*s%s %s", INDENT, ext_substmt_info[substmt].name, text);
     } else {
         ypr_text(ctx, ext_substmt_info[substmt].name, text,
                  (ext_substmt_info[substmt].flags & SUBST_FLAG_YIN) ? 0 : 1, 0);
@@ -373,15 +373,15 @@
 yprp_revision(struct ypr_ctx *ctx, const struct lysp_revision *rev)
 {
     if (rev->dsc || rev->ref || rev->exts) {
-        lyp_print(ctx->out, "%*srevision %s {\n", INDENT, rev->date);
+        ly_print(ctx->out, "%*srevision %s {\n", INDENT, rev->date);
         LEVEL++;
         yprp_extension_instances(ctx, LYEXT_SUBSTMT_SELF, 0, rev->exts, NULL, 0);
         ypr_substmt(ctx, LYEXT_SUBSTMT_DESCRIPTION, 0, rev->dsc, rev->exts);
         ypr_substmt(ctx, LYEXT_SUBSTMT_REFERENCE, 0, rev->ref, rev->exts);
         LEVEL--;
-        lyp_print(ctx->out, "%*s}\n", INDENT);
+        ly_print(ctx->out, "%*s}\n", INDENT);
     } else {
-        lyp_print(ctx->out, "%*srevision %s;\n", INDENT, rev->date);
+        ly_print(ctx->out, "%*srevision %s;\n", INDENT, rev->date);
     }
 }
 
@@ -450,7 +450,7 @@
         ypr_open(ctx->out, flag);
         extflag = 0;
 
-        lyp_print(ctx->out, "%*sif-feature \"%s\"", INDENT, iff[u]);
+        ly_print(ctx->out, "%*sif-feature \"%s\"", INDENT, iff[u]);
 
         /* extensions */
         LEVEL++;
@@ -477,14 +477,14 @@
     switch (op) {
     case LYS_IFF_F:
         if (ctx->module == feat->features[*index_f]->module) {
-            lyp_print(ctx->out, "%s", feat->features[*index_f]->name);
+            ly_print(ctx->out, "%s", feat->features[*index_f]->name);
         } else {
-            lyp_print(ctx->out, "%s:%s", feat->features[*index_f]->module->prefix, feat->features[*index_f]->name);
+            ly_print(ctx->out, "%s:%s", feat->features[*index_f]->module->prefix, feat->features[*index_f]->name);
         }
         (*index_f)++;
         break;
     case LYS_IFF_NOT:
-        lyp_print(ctx->out, "not ");
+        ly_print(ctx->out, "not ");
         yprc_iffeature(ctx, feat, index_e, index_f);
         break;
     case LYS_IFF_AND:
@@ -497,13 +497,13 @@
         /* falls through */
     case LYS_IFF_OR:
         if (brackets_flag) {
-            lyp_print(ctx->out, "(");
+            ly_print(ctx->out, "(");
         }
         yprc_iffeature(ctx, feat, index_e, index_f);
-        lyp_print(ctx->out, " %s ", op == LYS_IFF_OR ? "or" : "and");
+        ly_print(ctx->out, " %s ", op == LYS_IFF_OR ? "or" : "and");
         yprc_iffeature(ctx, feat, index_e, index_f);
         if (brackets_flag) {
-            lyp_print(ctx->out, ")");
+            ly_print(ctx->out, ")");
         }
     }
 }
@@ -520,9 +520,9 @@
         ypr_open(ctx->out, flag);
         extflag = 0;
 
-        lyp_print(ctx->out, "%*sif-feature \"", INDENT);
+        ly_print(ctx->out, "%*sif-feature \"", INDENT);
         yprc_iffeature(ctx, iff, &index_e, &index_f);
-        lyp_print(ctx->out, "\"");
+        ly_print(ctx->out, "\"");
 
         /* extensions */
         LEVEL++;
@@ -543,7 +543,7 @@
     int flag = 0, flag2 = 0;
     LY_ARRAY_SIZE_TYPE u;
 
-    lyp_print(ctx->out, "%*sextension %s", INDENT, ext->name);
+    ly_print(ctx->out, "%*sextension %s", INDENT, ext->name);
     LEVEL++;
 
     if (ext->exts) {
@@ -552,7 +552,7 @@
 
     if (ext->argument) {
         ypr_open(ctx->out, &flag);
-        lyp_print(ctx->out, "%*sargument %s", INDENT, ext->argument);
+        ly_print(ctx->out, "%*sargument %s", INDENT, ext->argument);
         LEVEL++;
         if (ext->exts) {
             u = -1;
@@ -582,7 +582,7 @@
 {
     int flag = 0;
 
-    lyp_print(ctx->out, "\n%*sfeature %s", INDENT, feat->name);
+    ly_print(ctx->out, "\n%*sfeature %s", INDENT, feat->name);
     LEVEL++;
     yprp_extension_instances(ctx, LYEXT_SUBSTMT_SELF, 0, feat->exts, &flag, 0);
     yprp_iffeatures(ctx, feat->iffeatures, feat->exts, &flag);
@@ -598,7 +598,7 @@
 {
     int flag = 0;
 
-    lyp_print(ctx->out, "\n%*sfeature %s", INDENT, feat->name);
+    ly_print(ctx->out, "\n%*sfeature %s", INDENT, feat->name);
     LEVEL++;
     yprc_extension_instances(ctx, LYEXT_SUBSTMT_SELF, 0, feat->exts, &flag, 0);
     yprc_iffeatures(ctx, feat->iffeatures, feat->exts, &flag);
@@ -615,7 +615,7 @@
     int flag = 0;
     LY_ARRAY_SIZE_TYPE u;
 
-    lyp_print(ctx->out, "\n%*sidentity %s", INDENT, ident->name);
+    ly_print(ctx->out, "\n%*sidentity %s", INDENT, ident->name);
     LEVEL++;
 
     yprp_extension_instances(ctx, LYEXT_SUBSTMT_SELF, 0, ident->exts, &flag, 0);
@@ -640,7 +640,7 @@
     int flag = 0;
     LY_ARRAY_SIZE_TYPE u;
 
-    lyp_print(ctx->out, "\n%*sidentity %s", INDENT, ident->name);
+    ly_print(ctx->out, "\n%*sidentity %s", INDENT, ident->name);
     LEVEL++;
 
     yprc_extension_instances(ctx, LYEXT_SUBSTMT_SELF, 0, ident->exts, &flag, 0);
@@ -649,9 +649,9 @@
     LY_ARRAY_FOR(ident->derived, u) {
         ypr_open(ctx->out, &flag);
         if (ctx->module != ident->derived[u]->module) {
-            lyp_print(ctx->out, "%*sderived %s:%s;\n", INDENT, ident->derived[u]->module->prefix, ident->derived[u]->name);
+            ly_print(ctx->out, "%*sderived %s:%s;\n", INDENT, ident->derived[u]->module->prefix, ident->derived[u]->name);
         } else {
-            lyp_print(ctx->out, "%*sderived %s;\n", INDENT, ident->derived[u]->name);
+            ly_print(ctx->out, "%*sderived %s;\n", INDENT, ident->derived[u]->name);
         }
     }
 
@@ -673,9 +673,9 @@
     }
 
     ypr_open(ctx->out, flag);
-    lyp_print(ctx->out, "%*s%s \"", INDENT, name);
+    ly_print(ctx->out, "%*s%s \"", INDENT, name);
     ypr_encode(ctx->out, (restr->arg[0] != 0x15 && restr->arg[0] != 0x06) ? restr->arg : &restr->arg[1], -1);
-    lyp_print(ctx->out, "\"");
+    ly_print(ctx->out, "\"");
 
     LEVEL++;
     yprp_extension_instances(ctx, LYEXT_SUBSTMT_SELF, 0, restr->exts, &inner_flag, 0);
@@ -705,9 +705,9 @@
     int inner_flag = 0;
 
     ypr_open(ctx->out, flag);
-    lyp_print(ctx->out, "%*smust \"", INDENT);
+    ly_print(ctx->out, "%*smust \"", INDENT);
     ypr_encode(ctx->out, must->cond->expr, -1);
-    lyp_print(ctx->out, "\"");
+    ly_print(ctx->out, "\"");
 
     LEVEL++;
     yprc_extension_instances(ctx, LYEXT_SUBSTMT_SELF, 0, must->exts, &inner_flag, 0);
@@ -737,26 +737,26 @@
     }
 
     ypr_open(ctx->out, flag);
-    lyp_print(ctx->out, "%*s%s \"", INDENT, (basetype == LY_TYPE_STRING || basetype == LY_TYPE_BINARY) ? "length" : "range");
+    ly_print(ctx->out, "%*s%s \"", INDENT, (basetype == LY_TYPE_STRING || basetype == LY_TYPE_BINARY) ? "length" : "range");
     LY_ARRAY_FOR(range->parts, u) {
         if (u > 0) {
-            lyp_print(ctx->out, " | ");
+            ly_print(ctx->out, " | ");
         }
         if (range->parts[u].max_64 == range->parts[u].min_64) {
             if (basetype <= LY_TYPE_STRING) { /* unsigned values */
-                lyp_print(ctx->out, "%"PRIu64, range->parts[u].max_u64);
+                ly_print(ctx->out, "%"PRIu64, range->parts[u].max_u64);
             } else { /* signed values */
-                lyp_print(ctx->out, "%"PRId64, range->parts[u].max_64);
+                ly_print(ctx->out, "%"PRId64, range->parts[u].max_64);
             }
         } else {
             if (basetype <= LY_TYPE_STRING) { /* unsigned values */
-                lyp_print(ctx->out, "%"PRIu64"..%"PRIu64, range->parts[u].min_u64, range->parts[u].max_u64);
+                ly_print(ctx->out, "%"PRIu64"..%"PRIu64, range->parts[u].min_u64, range->parts[u].max_u64);
             } else { /* signed values */
-                lyp_print(ctx->out, "%"PRId64"..%"PRId64, range->parts[u].min_64, range->parts[u].max_64);
+                ly_print(ctx->out, "%"PRId64"..%"PRId64, range->parts[u].min_64, range->parts[u].max_64);
             }
         }
     }
-    lyp_print(ctx->out, "\"");
+    ly_print(ctx->out, "\"");
 
     LEVEL++;
     yprc_extension_instances(ctx, LYEXT_SUBSTMT_SELF, 0, range->exts, &inner_flag, 0);
@@ -781,9 +781,9 @@
     int inner_flag = 0;
 
     ypr_open(ctx->out, flag);
-    lyp_print(ctx->out, "%*spattern \"", INDENT);
+    ly_print(ctx->out, "%*spattern \"", INDENT);
     ypr_encode(ctx->out, pattern->expr, -1);
-    lyp_print(ctx->out, "\"");
+    ly_print(ctx->out, "\"");
 
     LEVEL++;
     yprc_extension_instances(ctx, LYEXT_SUBSTMT_SELF, 0, pattern->exts, &inner_flag, 0);
@@ -817,9 +817,9 @@
     }
     ypr_open(ctx->out, flag);
 
-    lyp_print(ctx->out, "%*swhen \"", INDENT);
+    ly_print(ctx->out, "%*swhen \"", INDENT);
     ypr_encode(ctx->out, when->cond, -1);
-    lyp_print(ctx->out, "\"");
+    ly_print(ctx->out, "\"");
 
     LEVEL++;
     yprp_extension_instances(ctx, LYEXT_SUBSTMT_SELF, 0, when->exts, &inner_flag, 0);
@@ -839,9 +839,9 @@
     }
     ypr_open(ctx->out, flag);
 
-    lyp_print(ctx->out, "%*swhen \"", INDENT);
+    ly_print(ctx->out, "%*swhen \"", INDENT);
     ypr_encode(ctx->out, when->cond->expr, -1);
-    lyp_print(ctx->out, "\"");
+    ly_print(ctx->out, "\"");
 
     LEVEL++;
     yprc_extension_instances(ctx, LYEXT_SUBSTMT_SELF, 0, when->exts, &inner_flag, 0);
@@ -860,11 +860,11 @@
     LY_ARRAY_FOR(items, u) {
         ypr_open(ctx->out, flag);
         if (type == LY_TYPE_BITS) {
-            lyp_print(ctx->out, "%*sbit %s", INDENT, items[u].name);
+            ly_print(ctx->out, "%*sbit %s", INDENT, items[u].name);
         } else { /* LY_TYPE_ENUM */
-            lyp_print(ctx->out, "%*senum \"", INDENT);
+            ly_print(ctx->out, "%*senum \"", INDENT);
             ypr_encode(ctx->out, items[u].name, -1);
-            lyp_print(ctx->out, "\"");
+            ly_print(ctx->out, "\"");
         }
         inner_flag = 0;
         LEVEL++;
@@ -891,7 +891,7 @@
     LY_ARRAY_SIZE_TYPE u;
     int flag = 0;
 
-    lyp_print(ctx->out, "%*stype %s", INDENT, type->name);
+    ly_print(ctx->out, "%*stype %s", INDENT, type->name);
     LEVEL++;
 
     yprp_extension_instances(ctx, LYEXT_SUBSTMT_SELF, 0, type->exts, &flag, 0);
@@ -947,7 +947,7 @@
     LY_ARRAY_SIZE_TYPE u;
     int flag = 0;
 
-    lyp_print(ctx->out, "%*stype %s", INDENT, lys_datatype2str(type->basetype));
+    ly_print(ctx->out, "%*stype %s", INDENT, lys_datatype2str(type->basetype));
     LEVEL++;
 
     yprc_extension_instances(ctx, LYEXT_SUBSTMT_SELF, 0, type->exts, &flag, 0);
@@ -991,9 +991,9 @@
             int inner_flag = 0;
 
             ypr_open(ctx->out, &flag);
-            lyp_print(ctx->out, "%*s%s \"", INDENT, type->basetype == LY_TYPE_BITS ? "bit" : "enum");
+            ly_print(ctx->out, "%*s%s \"", INDENT, type->basetype == LY_TYPE_BITS ? "bit" : "enum");
             ypr_encode(ctx->out, item->name, -1);
-            lyp_print(ctx->out, "\"");
+            ly_print(ctx->out, "\"");
             LEVEL++;
             yprc_extension_instances(ctx, LYEXT_SUBSTMT_SELF, 0, item->exts, &inner_flag, 0);
             yprc_iffeatures(ctx, item->iffeatures, item->exts, &inner_flag);
@@ -1065,7 +1065,7 @@
 {
     LYOUT_CHECK(ctx->out);
 
-    lyp_print(ctx->out, "\n%*stypedef %s {\n", INDENT, tpdf->name);
+    ly_print(ctx->out, "\n%*stypedef %s {\n", INDENT, tpdf->name);
     LEVEL++;
 
     yprp_extension_instances(ctx, LYEXT_SUBSTMT_SELF, 0, tpdf->exts, NULL, 0);
@@ -1084,7 +1084,7 @@
     ypr_reference(ctx, tpdf->ref, tpdf->exts, NULL);
 
     LEVEL--;
-    lyp_print(ctx->out, "%*s}\n", INDENT);
+    ly_print(ctx->out, "%*s}\n", INDENT);
 }
 
 static void yprp_node(struct ypr_ctx *ctx, const struct lysp_node *node);
@@ -1100,7 +1100,7 @@
 
     LYOUT_CHECK(ctx->out);
 
-    lyp_print(ctx->out, "\n%*sgrouping %s", INDENT, grp->name);
+    ly_print(ctx->out, "\n%*sgrouping %s", INDENT, grp->name);
     LEVEL++;
 
     yprp_extension_instances(ctx, LYEXT_SUBSTMT_SELF, 0, grp->exts, &flag, 0);
@@ -1143,7 +1143,7 @@
     }
     ypr_open(ctx->out, flag);
 
-    lyp_print(ctx->out, "\n%*s%s {\n", INDENT, (inout->nodetype == LYS_INPUT ? "input" : "output"));
+    ly_print(ctx->out, "\n%*s%s {\n", INDENT, (inout->nodetype == LYS_INPUT ? "input" : "output"));
     LEVEL++;
 
     yprp_extension_instances(ctx, LYEXT_SUBSTMT_SELF, 0, inout->exts, NULL, 0);
@@ -1177,7 +1177,7 @@
     }
     ypr_open(ctx->out, flag);
 
-    lyp_print(ctx->out, "\n%*s%s {\n", INDENT, (&action->input == inout) ? "input" : "output");
+    ly_print(ctx->out, "\n%*s%s {\n", INDENT, (&action->input == inout) ? "input" : "output");
     LEVEL++;
 
     yprc_extension_instances(ctx, LYEXT_SUBSTMT_SELF, 0, (&action->input == inout) ? action->input_exts : action->output_exts, NULL, 0);
@@ -1204,7 +1204,7 @@
 
     LYOUT_CHECK(ctx->out);
 
-    lyp_print(ctx->out, "%*snotification %s", INDENT, notif->name);
+    ly_print(ctx->out, "%*snotification %s", INDENT, notif->name);
 
     LEVEL++;
     yprp_extension_instances(ctx, LYEXT_SUBSTMT_SELF, 0, notif->exts, &flag, 0);
@@ -1245,7 +1245,7 @@
 
     LYOUT_CHECK(ctx->out);
 
-    lyp_print(ctx->out, "%*snotification %s", INDENT, notif->name);
+    ly_print(ctx->out, "%*snotification %s", INDENT, notif->name);
 
     LEVEL++;
     yprc_extension_instances(ctx, LYEXT_SUBSTMT_SELF, 0, notif->exts, &flag, 0);
@@ -1277,7 +1277,7 @@
 
     LYOUT_CHECK(ctx->out);
 
-    lyp_print(ctx->out, "%*s%s %s", INDENT, action->parent ? "action" : "rpc", action->name);
+    ly_print(ctx->out, "%*s%s %s", INDENT, action->parent ? "action" : "rpc", action->name);
 
     LEVEL++;
     yprp_extension_instances(ctx, LYEXT_SUBSTMT_SELF, 0, action->exts, &flag, 0);
@@ -1310,7 +1310,7 @@
 
     LYOUT_CHECK(ctx->out);
 
-    lyp_print(ctx->out, "%*s%s %s", INDENT, action->parent ? "action" : "rpc", action->name);
+    ly_print(ctx->out, "%*s%s %s", INDENT, action->parent ? "action" : "rpc", action->name);
 
     LEVEL++;
     yprc_extension_instances(ctx, LYEXT_SUBSTMT_SELF, 0, action->exts, &flag, 0);
@@ -1329,7 +1329,7 @@
 static void
 yprp_node_common1(struct ypr_ctx *ctx, const struct lysp_node *node, int *flag)
 {
-    lyp_print(ctx->out, "%*s%s %s%s", INDENT, lys_nodetype2str(node->nodetype), node->name, flag ? "" : " {\n");
+    ly_print(ctx->out, "%*s%s %s%s", INDENT, lys_nodetype2str(node->nodetype), node->name, flag ? "" : " {\n");
     LEVEL++;
 
     yprp_extension_instances(ctx, LYEXT_SUBSTMT_SELF, 0, node->exts, flag, 0);
@@ -1342,7 +1342,7 @@
 {
     LY_ARRAY_SIZE_TYPE u;
 
-    lyp_print(ctx->out, "%*s%s %s%s", INDENT, lys_nodetype2str(node->nodetype), node->name, flag ? "" : " {\n");
+    ly_print(ctx->out, "%*s%s %s%s", INDENT, lys_nodetype2str(node->nodetype), node->name, flag ? "" : " {\n");
     LEVEL++;
 
     yprc_extension_instances(ctx, LYEXT_SUBSTMT_SELF, 0, node->exts, flag, 0);
@@ -1573,7 +1573,7 @@
     yprp_node_common2(ctx, node, NULL);
 
     LEVEL--;
-    lyp_print(ctx->out, "%*s}\n", INDENT);
+    ly_print(ctx->out, "%*s}\n", INDENT);
 }
 
 static void
@@ -1597,7 +1597,7 @@
     yprc_node_common2(ctx, node, NULL);
 
     LEVEL--;
-    lyp_print(ctx->out, "%*s}\n", INDENT);
+    ly_print(ctx->out, "%*s}\n", INDENT);
 }
 
 static void
@@ -1639,7 +1639,7 @@
     ypr_reference(ctx, node->ref, node->exts, NULL);
 
     LEVEL--;
-    lyp_print(ctx->out, "%*s}\n", INDENT);
+    ly_print(ctx->out, "%*s}\n", INDENT);
 }
 
 static void
@@ -1675,7 +1675,7 @@
     ypr_reference(ctx, node->ref, node->exts, NULL);
 
     LEVEL--;
-    lyp_print(ctx->out, "%*s}\n", INDENT);
+    ly_print(ctx->out, "%*s}\n", INDENT);
 }
 
 static void
@@ -1765,17 +1765,17 @@
     }
     if (!(list->flags & LYS_KEYLESS)) {
         ypr_open(ctx->out, &flag);
-        lyp_print(ctx->out, "%*skey \"", INDENT);
+        ly_print(ctx->out, "%*skey \"", INDENT);
         for (struct lysc_node *key = list->child; key && key->nodetype == LYS_LEAF && (key->flags & LYS_KEY); key = key->next) {
-            lyp_print(ctx->out, "%s%s", u > 0 ? ", " : "", key->name);
+            ly_print(ctx->out, "%s%s", u > 0 ? ", " : "", key->name);
         }
-        lyp_print(ctx->out, "\";\n");
+        ly_print(ctx->out, "\";\n");
     }
     LY_ARRAY_FOR(list->uniques, u) {
         ypr_open(ctx->out, &flag);
-        lyp_print(ctx->out, "%*sunique \"", INDENT);
+        ly_print(ctx->out, "%*sunique \"", INDENT);
         LY_ARRAY_FOR(list->uniques[u], v) {
-            lyp_print(ctx->out, "%s%s", v > 0 ? ", " : "", list->uniques[u][v]->name);
+            ly_print(ctx->out, "%s%s", v > 0 ? ", " : "", list->uniques[u][v]->name);
         }
         ypr_close(ctx, 0);
     }
@@ -1822,7 +1822,7 @@
     LY_ARRAY_SIZE_TYPE u;
     int flag = 0;
 
-    lyp_print(ctx->out, "%*srefine \"%s\"", INDENT, refine->nodeid);
+    ly_print(ctx->out, "%*srefine \"%s\"", INDENT, refine->nodeid);
     LEVEL++;
 
     yprp_extension_instances(ctx, LYEXT_SUBSTMT_SELF, 0, refine->exts, &flag, 0);
@@ -1872,7 +1872,7 @@
     LY_ARRAY_SIZE_TYPE u;
     struct lysp_node *child;
 
-    lyp_print(ctx->out, "%*saugment \"%s\" {\n", INDENT, aug->nodeid);
+    ly_print(ctx->out, "%*saugment \"%s\" {\n", INDENT, aug->nodeid);
     LEVEL++;
 
     yprp_extension_instances(ctx, LYEXT_SUBSTMT_SELF, 0, aug->exts, NULL, 0);
@@ -2038,7 +2038,7 @@
     struct lysp_deviate_del *del;
     struct lysp_deviate *elem;
 
-    lyp_print(ctx->out, "%*sdeviation \"%s\" {\n", INDENT, deviation->nodeid);
+    ly_print(ctx->out, "%*sdeviation \"%s\" {\n", INDENT, deviation->nodeid);
     LEVEL++;
 
     yprp_extension_instances(ctx, LYEXT_SUBSTMT_SELF, 0, deviation->exts, NULL, 0);
@@ -2046,20 +2046,20 @@
     ypr_reference(ctx, deviation->ref, deviation->exts, NULL);
 
     LY_LIST_FOR(deviation->deviates, elem) {
-        lyp_print(ctx->out, "%*sdeviate ", INDENT);
+        ly_print(ctx->out, "%*sdeviate ", INDENT);
         if (elem->mod == LYS_DEV_NOT_SUPPORTED) {
             if (elem->exts) {
-                lyp_print(ctx->out, "not-supported {\n");
+                ly_print(ctx->out, "not-supported {\n");
                 LEVEL++;
 
                 yprp_extension_instances(ctx, LYEXT_SUBSTMT_SELF, 0, elem->exts, NULL, 0);
             } else {
-                lyp_print(ctx->out, "not-supported;\n");
+                ly_print(ctx->out, "not-supported;\n");
                 continue;
             }
         } else if (elem->mod == LYS_DEV_ADD) {
             add = (struct lysp_deviate_add*)elem;
-            lyp_print(ctx->out, "add {\n");
+            ly_print(ctx->out, "add {\n");
             LEVEL++;
 
             yprp_extension_instances(ctx, LYEXT_SUBSTMT_SELF, 0, add->exts, NULL, 0);
@@ -2087,7 +2087,7 @@
             }
         } else if (elem->mod == LYS_DEV_REPLACE) {
             rpl = (struct lysp_deviate_rpl*)elem;
-            lyp_print(ctx->out, "replace {\n");
+            ly_print(ctx->out, "replace {\n");
             LEVEL++;
 
             yprp_extension_instances(ctx, LYEXT_SUBSTMT_SELF, 0, rpl->exts, NULL, 0);
@@ -2110,7 +2110,7 @@
             }
         } else if (elem->mod == LYS_DEV_DELETE) {
             del = (struct lysp_deviate_del*)elem;
-            lyp_print(ctx->out, "delete {\n");
+            ly_print(ctx->out, "delete {\n");
             LEVEL++;
 
             yprp_extension_instances(ctx, LYEXT_SUBSTMT_SELF, 0, del->exts, NULL, 0);
@@ -2155,7 +2155,7 @@
 
     /* meta-stmts */
     if (module->org || module->contact || module->dsc || module->ref) {
-        lyp_print(ctx->out, "\n");
+        ly_print(ctx->out, "\n");
     }
     ypr_substmt(ctx, LYEXT_SUBSTMT_ORGANIZATION, 0, module->org, NULL);
     ypr_substmt(ctx, LYEXT_SUBSTMT_CONTACT, 0, module->contact, NULL);
@@ -2164,29 +2164,29 @@
 
     /* revision-stmts */
     if (module->revision) {
-        lyp_print(ctx->out, "\n%*srevision %s;\n", INDENT, module->revision);
+        ly_print(ctx->out, "\n%*srevision %s;\n", INDENT, module->revision);
     }
 
     LEVEL--;
-    lyp_print(ctx->out, "%*s}\n", INDENT);
+    ly_print(ctx->out, "%*s}\n", INDENT);
     ly_print_flush(ctx->out);
 
     return LY_SUCCESS;
 }
 
 LY_ERR
-yang_print_parsed(struct lyp_out *out, const struct lys_module *module)
+yang_print_parsed(struct ly_out *out, const struct lys_module *module)
 {
     LY_ARRAY_SIZE_TYPE u;
     struct lysp_node *data;
     struct lysp_module *modp = module->parsed;
     struct ypr_ctx ctx_ = {.out = out, .level = 0, .module = module, .schema = YPR_PARSED}, *ctx = &ctx_;
 
-    lyp_print(ctx->out, "%*smodule %s {\n", INDENT, module->name);
+    ly_print(ctx->out, "%*smodule %s {\n", INDENT, module->name);
     LEVEL++;
 
     if (!modp) {
-        lyp_print(ctx->out, "%*s/* PARSED INFORMATION ARE NOT FULLY PRESENT */\n", INDENT);
+        ly_print(ctx->out, "%*s/* PARSED INFORMATION ARE NOT FULLY PRESENT */\n", INDENT);
         return ypr_missing_format(ctx, module);
     }
 
@@ -2201,7 +2201,7 @@
 
     /* linkage-stmts */
     LY_ARRAY_FOR(modp->imports, u) {
-        lyp_print(out, "%s%*simport %s {\n", u ? "" : "\n", INDENT, modp->imports[u].module->name);
+        ly_print(out, "%s%*simport %s {\n", u ? "" : "\n", INDENT, modp->imports[u].module->name);
         LEVEL++;
         yprp_extension_instances(ctx, LYEXT_SUBSTMT_SELF, 0, modp->imports[u].exts, NULL, 0);
         ypr_substmt(ctx, LYEXT_SUBSTMT_PREFIX, 0, modp->imports[u].prefix, modp->imports[u].exts);
@@ -2211,11 +2211,11 @@
         ypr_substmt(ctx, LYEXT_SUBSTMT_DESCRIPTION, 0, modp->imports[u].dsc, modp->imports[u].exts);
         ypr_substmt(ctx, LYEXT_SUBSTMT_REFERENCE, 0, modp->imports[u].ref, modp->imports[u].exts);
         LEVEL--;
-        lyp_print(out, "%*s}\n", INDENT);
+        ly_print(out, "%*s}\n", INDENT);
     }
     LY_ARRAY_FOR(modp->includes, u) {
         if (modp->includes[u].rev[0] || modp->includes[u].dsc || modp->includes[u].ref || modp->includes[u].exts) {
-            lyp_print(out, "%s%*sinclude %s {\n", u ? "" : "\n",  INDENT, modp->includes[u].submodule->name);
+            ly_print(out, "%s%*sinclude %s {\n", u ? "" : "\n",  INDENT, modp->includes[u].submodule->name);
             LEVEL++;
             yprp_extension_instances(ctx, LYEXT_SUBSTMT_SELF, 0, modp->includes[u].exts, NULL, 0);
             if (modp->includes[u].rev[0]) {
@@ -2224,15 +2224,15 @@
             ypr_substmt(ctx, LYEXT_SUBSTMT_DESCRIPTION, 0, modp->includes[u].dsc, modp->includes[u].exts);
             ypr_substmt(ctx, LYEXT_SUBSTMT_REFERENCE, 0, modp->includes[u].ref, modp->includes[u].exts);
             LEVEL--;
-            lyp_print(out, "%*s}\n", INDENT);
+            ly_print(out, "%*s}\n", INDENT);
         } else {
-            lyp_print(out, "\n%*sinclude \"%s\";\n", INDENT, modp->includes[u].submodule->name);
+            ly_print(out, "\n%*sinclude \"%s\";\n", INDENT, modp->includes[u].submodule->name);
         }
     }
 
     /* meta-stmts */
     if (module->org || module->contact || module->dsc || module->ref) {
-        lyp_print(out, "\n");
+        ly_print(out, "\n");
     }
     ypr_substmt(ctx, LYEXT_SUBSTMT_ORGANIZATION, 0, module->org, modp->exts);
     ypr_substmt(ctx, LYEXT_SUBSTMT_CONTACT, 0, module->contact, modp->exts);
@@ -2241,18 +2241,18 @@
 
     /* revision-stmts */
     if (modp->revs) {
-        lyp_print(out, "\n");
+        ly_print(out, "\n");
     }
     LY_ARRAY_FOR(modp->revs, u) {
         yprp_revision(ctx, &modp->revs[u]);
     }
     /* body-stmts */
     LY_ARRAY_FOR(modp->extensions, u) {
-        lyp_print(out, "\n");
+        ly_print(out, "\n");
         yprp_extension(ctx, &modp->extensions[u]);
     }
     if (modp->exts) {
-        lyp_print(out, "\n");
+        ly_print(out, "\n");
         yprp_extension_instances(ctx, LYEXT_SUBSTMT_SELF, 0, module->parsed->exts, NULL, 0);
     }
 
@@ -2293,14 +2293,14 @@
     }
 
     LEVEL--;
-    lyp_print(out, "%*s}\n", INDENT);
+    ly_print(out, "%*s}\n", INDENT);
     ly_print_flush(out);
 
     return LY_SUCCESS;
 }
 
 LY_ERR
-yang_print_compiled_node(struct lyp_out *out, const struct lysc_node *node, int options)
+yang_print_compiled_node(struct ly_out *out, const struct lysc_node *node, int options)
 {
     struct ypr_ctx ctx_ = {.out = out, .level = 0, .module = node->module, .options = options}, *ctx = &ctx_;
 
@@ -2311,18 +2311,18 @@
 }
 
 LY_ERR
-yang_print_compiled(struct lyp_out *out, const struct lys_module *module, int options)
+yang_print_compiled(struct ly_out *out, const struct lys_module *module, int options)
 {
     LY_ARRAY_SIZE_TYPE u;
     struct lysc_node *data;
     struct lysc_module *modc = module->compiled;
     struct ypr_ctx ctx_ = {.out = out, .level = 0, .module = module, .options = options}, *ctx = &ctx_;
 
-    lyp_print(ctx->out, "%*smodule %s {\n", INDENT, module->name);
+    ly_print(ctx->out, "%*smodule %s {\n", INDENT, module->name);
     LEVEL++;
 
     if (!modc) {
-        lyp_print(ctx->out, "%*s/* COMPILED INFORMATION ARE NOT PRESENT */\n", INDENT);
+        ly_print(ctx->out, "%*s/* COMPILED INFORMATION ARE NOT PRESENT */\n", INDENT);
         return ypr_missing_format(ctx, module);
     }
 
@@ -2337,7 +2337,7 @@
 
     /* linkage-stmts */
     LY_ARRAY_FOR(modc->imports, u) {
-        lyp_print(out, "\n%*simport %s {\n", INDENT, modc->imports[u].module->name);
+        ly_print(out, "\n%*simport %s {\n", INDENT, modc->imports[u].module->name);
         LEVEL++;
         yprc_extension_instances(ctx, LYEXT_SUBSTMT_SELF, 0, modc->imports[u].exts, NULL, 0);
         ypr_substmt(ctx, LYEXT_SUBSTMT_PREFIX, 0, modc->imports[u].prefix, modc->imports[u].exts);
@@ -2345,12 +2345,12 @@
             ypr_substmt(ctx, LYEXT_SUBSTMT_REVISIONDATE, 0, modc->imports[u].module->revision, modc->imports[u].exts);
         }
         LEVEL--;
-        lyp_print(out, "%*s}\n", INDENT);
+        ly_print(out, "%*s}\n", INDENT);
     }
 
     /* meta-stmts */
     if (module->org || module->contact || module->dsc || module->ref) {
-        lyp_print(out, "\n");
+        ly_print(out, "\n");
     }
     ypr_substmt(ctx, LYEXT_SUBSTMT_ORGANIZATION, 0, module->org, modc->exts);
     ypr_substmt(ctx, LYEXT_SUBSTMT_CONTACT, 0, module->contact, modc->exts);
@@ -2359,12 +2359,12 @@
 
     /* revision-stmts */
     if (module->revision) {
-        lyp_print(ctx->out, "\n%*srevision %s;\n", INDENT, module->revision);
+        ly_print(ctx->out, "\n%*srevision %s;\n", INDENT, module->revision);
     }
 
     /* body-stmts */
     if (modc->exts) {
-        lyp_print(out, "\n");
+        ly_print(out, "\n");
         yprc_extension_instances(ctx, LYEXT_SUBSTMT_SELF, 0, module->compiled->exts, NULL, 0);
     }
 
@@ -2391,7 +2391,7 @@
     }
 
     LEVEL--;
-    lyp_print(out, "%*s}\n", INDENT);
+    ly_print(out, "%*s}\n", INDENT);
     ly_print_flush(out);
 
     return LY_SUCCESS;
diff --git a/src/printer_yin.c b/src/printer_yin.c
index c27404a..e4b1f44 100644
--- a/src/printer_yin.c
+++ b/src/printer_yin.c
@@ -34,7 +34,7 @@
  * @brief YIN printer context.
  */
 struct ypr_ctx {
-    struct lyp_out *out;               /**< output specification */
+    struct ly_out *out;               /**< output specification */
     unsigned int level;              /**< current indentation level: 0 - no formatting, >= 1 indentation levels */
     const struct lys_module *module; /**< schema to print */
 };
@@ -48,14 +48,14 @@
 static void
 ypr_open(struct ypr_ctx *ctx, const char *elem_name, const char *attr_name, const char *attr_value,  int flag)
 {
-    lyp_print(ctx->out, "%*s<%s", INDENT, elem_name);
+    ly_print(ctx->out, "%*s<%s", INDENT, elem_name);
 
     if (attr_name) {
-        lyp_print(ctx->out, " %s=\"", attr_name);
+        ly_print(ctx->out, " %s=\"", attr_name);
         lyxml_dump_text(ctx->out, attr_value, 1);
-        lyp_print(ctx->out, "\"%s", flag == -1 ? "/>\n" : flag == 1 ? ">\n" : "");
+        ly_print(ctx->out, "\"%s", flag == -1 ? "/>\n" : flag == 1 ? ">\n" : "");
     } else if (flag) {
-        lyp_print(ctx->out, flag == -1 ? "/>\n" : ">\n");
+        ly_print(ctx->out, flag == -1 ? "/>\n" : ">\n");
     }
 }
 
@@ -63,9 +63,9 @@
 ypr_close(struct ypr_ctx *ctx, const char *elem_name, int flag)
 {
     if (flag) {
-        lyp_print(ctx->out, "%*s</%s>\n", INDENT, elem_name);
+        ly_print(ctx->out, "%*s</%s>\n", INDENT, elem_name);
     } else {
-        lyp_print(ctx->out, "/>\n");
+        ly_print(ctx->out, "/>\n");
     }
 }
 
@@ -79,16 +79,16 @@
 {
     if (par_close_flag && !(*par_close_flag)) {
         (*par_close_flag) = 1;
-        lyp_print(ctx->out, ">\n");
+        ly_print(ctx->out, ">\n");
     }
 }
 
 static void
 ypr_yin_arg(struct ypr_ctx *ctx, const char *arg, const char *text)
 {
-    lyp_print(ctx->out, "%*s<%s>", INDENT, arg);
+    ly_print(ctx->out, "%*s<%s>", INDENT, arg);
     lyxml_dump_text(ctx->out, text, 0);
-    lyp_print(ctx->out, "</%s>\n", arg);
+    ly_print(ctx->out, "</%s>\n", arg);
 }
 
 
@@ -236,7 +236,7 @@
         ypr_close_parent(ctx, flag);
         extflag = 0;
 
-        lyp_print(ctx->out, "%*s<if-feature name=\"%s",  INDENT, iff[u]);
+        ly_print(ctx->out, "%*s<if-feature name=\"%s",  INDENT, iff[u]);
 
         /* extensions */
         LEVEL++;
@@ -247,7 +247,7 @@
             yprp_extension_instances(ctx, LYEXT_SUBSTMT_IFFEATURE, u, &exts[u], &extflag, 1);
         }
         LEVEL--;
-        lyp_print(ctx->out, "\"/>\n");
+        ly_print(ctx->out, "\"/>\n");
     }
 }
 
@@ -345,9 +345,9 @@
         return;
     }
 
-    lyp_print(ctx->out, "%*s<%s %s=\"", INDENT, name, attr);
+    ly_print(ctx->out, "%*s<%s %s=\"", INDENT, name, attr);
     lyxml_dump_text(ctx->out, (restr->arg[0] != 0x15 && restr->arg[0] != 0x06) ? restr->arg : &restr->arg[1], 1);
-    lyp_print(ctx->out, "\"");
+    ly_print(ctx->out, "\"");
 
     LEVEL++;
     yprp_extension_instances(ctx, LYEXT_SUBSTMT_SELF, 0, restr->exts, &inner_flag, 0);
@@ -381,9 +381,9 @@
         return;
     }
 
-    lyp_print(ctx->out, "%*s<when condition=\"", INDENT);
+    ly_print(ctx->out, "%*s<when condition=\"", INDENT);
     lyxml_dump_text(ctx->out, when->cond, 1);
-    lyp_print(ctx->out, "\"");
+    ly_print(ctx->out, "\"");
 
     LEVEL++;
     yprp_extension_instances(ctx, LYEXT_SUBSTMT_SELF, 0, when->exts, &inner_flag, 0);
@@ -402,13 +402,13 @@
 
     LY_ARRAY_FOR(items, u) {
         if (type == LY_TYPE_BITS) {
-            lyp_print(ctx->out, "%*s<bit name=\"", INDENT);
+            ly_print(ctx->out, "%*s<bit name=\"", INDENT);
             lyxml_dump_text(ctx->out, items[u].name, 1);
-            lyp_print(ctx->out, "\"");
+            ly_print(ctx->out, "\"");
         } else { /* LY_TYPE_ENUM */
-            lyp_print(ctx->out, "%*s<enum name=\"", INDENT);
+            ly_print(ctx->out, "%*s<enum name=\"", INDENT);
             lyxml_dump_text(ctx->out, items[u].name, 1);
-            lyp_print(ctx->out, "\"");
+            ly_print(ctx->out, "\"");
         }
         inner_flag = 0;
         LEVEL++;
@@ -1099,20 +1099,20 @@
     ypr_reference(ctx, deviation->ref, deviation->exts, NULL);
 
     LY_LIST_FOR(deviation->deviates, elem) {
-        lyp_print(ctx->out, "%*s<deviate value=\"", INDENT);
+        ly_print(ctx->out, "%*s<deviate value=\"", INDENT);
         if (elem->mod == LYS_DEV_NOT_SUPPORTED) {
             if (elem->exts) {
-                lyp_print(ctx->out, "not-supported\"/>\n");
+                ly_print(ctx->out, "not-supported\"/>\n");
                 LEVEL++;
 
                 yprp_extension_instances(ctx, LYEXT_SUBSTMT_SELF, 0, elem->exts, NULL, 0);
             } else {
-                lyp_print(ctx->out, "not-supported\"/>\n");
+                ly_print(ctx->out, "not-supported\"/>\n");
                 continue;
             }
         } else if (elem->mod == LYS_DEV_ADD) {
             add = (struct lysp_deviate_add*)elem;
-            lyp_print(ctx->out, "add\">\n");
+            ly_print(ctx->out, "add\">\n");
             LEVEL++;
 
             yprp_extension_instances(ctx, LYEXT_SUBSTMT_SELF, 0, add->exts, NULL, 0);
@@ -1140,7 +1140,7 @@
             }
         } else if (elem->mod == LYS_DEV_REPLACE) {
             rpl = (struct lysp_deviate_rpl*)elem;
-            lyp_print(ctx->out, "replace\">\n");
+            ly_print(ctx->out, "replace\">\n");
             LEVEL++;
 
             yprp_extension_instances(ctx, LYEXT_SUBSTMT_SELF, 0, rpl->exts, NULL, 0);
@@ -1163,7 +1163,7 @@
             }
         } else if (elem->mod == LYS_DEV_DELETE) {
             del = (struct lysp_deviate_del*)elem;
-            lyp_print(ctx->out, "delete\">\n");
+            ly_print(ctx->out, "delete\">\n");
             LEVEL++;
 
             yprp_extension_instances(ctx, LYEXT_SUBSTMT_SELF, 0, del->exts, NULL, 0);
@@ -1206,7 +1206,7 @@
 
     /* meta-stmts */
     if (module->org || module->contact || module->dsc || module->ref) {
-        lyp_print(ctx->out, "\n");
+        ly_print(ctx->out, "\n");
     }
     ypr_substmt(ctx, LYEXT_SUBSTMT_ORGANIZATION, 0, module->org, NULL);
     ypr_substmt(ctx, LYEXT_SUBSTMT_CONTACT, 0, module->contact, NULL);
@@ -1230,13 +1230,13 @@
 {
     LY_ARRAY_SIZE_TYPE u;
 
-    lyp_print(ctx->out, "%*sxmlns=\"%s\"", indent + INDENT, YIN_NS_URI);
-    lyp_print(ctx->out, "\n%*sxmlns:%s=\"%s\"", indent + INDENT, module->prefix, module->ns);
+    ly_print(ctx->out, "%*sxmlns=\"%s\"", indent + INDENT, YIN_NS_URI);
+    ly_print(ctx->out, "\n%*sxmlns:%s=\"%s\"", indent + INDENT, module->prefix, module->ns);
 
     struct lysp_module *modp = module->parsed;
 
     LY_ARRAY_FOR(modp->imports, u){
-        lyp_print(ctx->out, "\n%*sxmlns:%s=\"%s\"", indent + INDENT, modp->imports[u].prefix, modp->imports[u].module->ns);
+        ly_print(ctx->out, "\n%*sxmlns:%s=\"%s\"", indent + INDENT, modp->imports[u].prefix, modp->imports[u].module->ns);
     }
 }
 
@@ -1375,7 +1375,7 @@
         }
 
         if (!ext->compiled && ext->yin) {
-            lyp_print(ctx->out, "%*s<%s/> <!-- Model comes from different input format, extensions must be resolved first. -->\n", INDENT, ext[u].name);
+            ly_print(ctx->out, "%*s<%s/> <!-- Model comes from different input format, extensions must be resolved first. -->\n", INDENT, ext[u].name);
             continue;
         }
 
@@ -1419,22 +1419,22 @@
 }
 
 LY_ERR
-yin_print_parsed(struct lyp_out *out, const struct lys_module *module)
+yin_print_parsed(struct ly_out *out, const struct lys_module *module)
 {
     unsigned int u;
     struct lysp_node *data;
     struct lysp_module *modp = module->parsed;
     struct ypr_ctx ctx_ = {.out = out, .level = 0, .module = module}, *ctx = &ctx_;
 
-    lyp_print(ctx->out, "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n");
-    lyp_print(ctx->out, "%*s<module name=\"%s\"\n", INDENT, module->name);
+    ly_print(ctx->out, "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n");
+    ly_print(ctx->out, "%*s<module name=\"%s\"\n", INDENT, module->name);
     ypr_xmlns(ctx, module, 8);
-    lyp_print(ctx->out, ">\n");
+    ly_print(ctx->out, ">\n");
 
     LEVEL++;
 
     if (!modp) {
-        lyp_print(ctx->out, "%*s<!-- PARSED INFORMATION ARE NOT FULLY PRESENT -->\n", INDENT);
+        ly_print(ctx->out, "%*s<!-- PARSED INFORMATION ARE NOT FULLY PRESENT -->\n", INDENT);
         return ypr_missing_format(ctx, module);
     }
 
@@ -1472,7 +1472,7 @@
             ypr_substmt(ctx, LYEXT_SUBSTMT_DESCRIPTION, 0, modp->includes[u].dsc, modp->includes[u].exts);
             ypr_substmt(ctx, LYEXT_SUBSTMT_REFERENCE, 0, modp->includes[u].ref, modp->includes[u].exts);
             LEVEL--;
-            lyp_print(out, "%*s}\n", INDENT);
+            ly_print(out, "%*s}\n", INDENT);
         } else {
             ypr_open(ctx, "include", "module", modp->includes[u].submodule->name, -1);
         }
@@ -1480,7 +1480,7 @@
 
     /* meta-stmts */
     if (module->org || module->contact || module->dsc || module->ref) {
-        lyp_print(out, "\n");
+        ly_print(out, "\n");
     }
     ypr_substmt(ctx, LYEXT_SUBSTMT_ORGANIZATION, 0, module->org, modp->exts);
     ypr_substmt(ctx, LYEXT_SUBSTMT_CONTACT, 0, module->contact, modp->exts);
@@ -1489,18 +1489,18 @@
 
     /* revision-stmts */
     if (modp->revs) {
-        lyp_print(out, "\n");
+        ly_print(out, "\n");
     }
     LY_ARRAY_FOR(modp->revs, u) {
         yprp_revision(ctx, &modp->revs[u]);
     }
     /* body-stmts */
     LY_ARRAY_FOR(modp->extensions, u) {
-        lyp_print(out, "\n");
+        ly_print(out, "\n");
         yprp_extension(ctx, &modp->extensions[u]);
     }
     if (modp->exts) {
-        lyp_print(out, "\n");
+        ly_print(out, "\n");
         yprp_extension_instances(ctx, LYEXT_SUBSTMT_SELF, 0, module->parsed->exts, NULL, 0);
     }
 
@@ -1541,7 +1541,7 @@
     }
 
     LEVEL--;
-    lyp_print(out, "%*s</module>\n", INDENT);
+    ly_print(out, "%*s</module>\n", INDENT);
     ly_print_flush(out);
 
     return LY_SUCCESS;
diff --git a/src/xml.c b/src/xml.c
index b682960..cbc1dc2 100644
--- a/src/xml.c
+++ b/src/xml.c
@@ -1025,7 +1025,7 @@
 }
 
 LY_ERR
-lyxml_dump_text(struct lyp_out *out, const char *text, int attribute)
+lyxml_dump_text(struct ly_out *out, const char *text, int attribute)
 {
     LY_ERR ret = LY_SUCCESS;
     unsigned int u;
@@ -1037,23 +1037,23 @@
     for (u = 0; text[u]; u++) {
         switch (text[u]) {
         case '&':
-            ret = lyp_print(out, "&amp;");
+            ret = ly_print(out, "&amp;");
             break;
         case '<':
-            ret = lyp_print(out, "&lt;");
+            ret = ly_print(out, "&lt;");
             break;
         case '>':
             /* not needed, just for readability */
-            ret = lyp_print(out, "&gt;");
+            ret = ly_print(out, "&gt;");
             break;
         case '"':
             if (attribute) {
-                ret = lyp_print(out, "&quot;");
+                ret = ly_print(out, "&quot;");
                 break;
             }
             /* falls through */
         default:
-            lyp_write(out, &text[u], 1);
+            ly_write(out, &text[u], 1);
         }
     }
 
diff --git a/src/xml.h b/src/xml.h
index c4ade27..b45c55f 100644
--- a/src/xml.h
+++ b/src/xml.h
@@ -22,7 +22,7 @@
 #include "set.h"
 #include "tree_schema.h"
 
-struct lyp_out;
+struct ly_out;
 struct ly_prefix;
 
 /* Macro to test if character is whitespace */
@@ -128,7 +128,7 @@
  * @param[in] attribute Flag for attribute's value where a double quotes must be replaced.
  * @return LY_ERR values.
  */
-LY_ERR lyxml_dump_text(struct lyp_out *out, const char *text, int attribute);
+LY_ERR lyxml_dump_text(struct ly_out *out, const char *text, int attribute);
 
 /**
  * @brief Remove the allocated working memory of the context.
diff --git a/src/xpath.c b/src/xpath.c
index 9f9dde4..f8333d1 100644
--- a/src/xpath.c
+++ b/src/xpath.c
@@ -400,7 +400,7 @@
             buf = strdup("");
             LY_CHECK_ERR_RET(!buf, LOGMEM(LYD_NODE_CTX(node)), LY_EMEM);
         } else {
-            struct lyp_out *out;
+            struct ly_out *out;
 
             switch (any->value_type) {
             case LYD_ANYDATA_STRING:
@@ -410,9 +410,9 @@
                 LY_CHECK_ERR_RET(!buf, LOGMEM(LYD_NODE_CTX(node)), LY_EMEM);
                 break;
             case LYD_ANYDATA_DATATREE:
-                out = lyp_new_memory(&buf, 0);
+                out = ly_out_new_memory(&buf, 0);
                 rc = lyd_print(out, any->value.tree, LYD_XML, LYDP_WITHSIBLINGS);
-                lyp_free(out, NULL, 0);
+                ly_out_free(out, NULL, 0);
                 LY_CHECK_RET(rc < 0, -rc);
                 break;
             /* TODO case LYD_ANYDATA_LYB:
diff --git a/tests/utests/data/test_parser_xml.c b/tests/utests/data/test_parser_xml.c
index a40fdf5..0c51134 100644
--- a/tests/utests/data/test_parser_xml.c
+++ b/tests/utests/data/test_parser_xml.c
@@ -175,8 +175,8 @@
     char *str;
     struct lyd_node *tree;
 
-    struct lyp_out *out;
-    assert_non_null(out = lyp_new_memory(&str, 0));
+    struct ly_out *out;
+    assert_non_null(out = ly_out_new_memory(&str, 0));
 
     data =
     "<any xmlns=\"urn:tests:a\">"
@@ -199,10 +199,10 @@
             "<element1a/>"
         "</any>"
     );
-    lyp_out_reset(out);
+    ly_out_reset(out);
 
     lyd_free_all(tree);
-    lyp_free(out, NULL, 1);
+    ly_out_free(out, NULL, 1);
 
     *state = NULL;
 }
@@ -324,8 +324,8 @@
     char *str;
     struct lyd_node *tree;
 
-    struct lyp_out *out;
-    assert_non_null(out = lyp_new_memory(&str, 0));
+    struct ly_out *out;
+    assert_non_null(out = ly_out_new_memory(&str, 0));
 
     /* invalid value, no flags */
     data = "<foo3 xmlns=\"urn:tests:a\"/>";
@@ -342,7 +342,7 @@
 
     lyd_print(out, tree, LYD_XML, 0);
     assert_string_equal(str, "<foo3 xmlns=\"urn:tests:a\"/>");
-    lyp_out_reset(out);
+    ly_out_reset(out);
     lyd_free_all(tree);
 
     /* missing key, no flags */
@@ -360,7 +360,7 @@
 
     lyd_print(out, tree, LYD_XML, 0);
     assert_string_equal(str, data);
-    lyp_out_reset(out);
+    ly_out_reset(out);
     lyd_free_all(tree);
 
     /* invalid key, no flags */
@@ -378,7 +378,7 @@
 
     lyd_print(out, tree, LYD_XML, 0);
     assert_string_equal(str, data);
-    lyp_out_reset(out);
+    ly_out_reset(out);
     lyd_free_all(tree);
 
     /* opaq flag and fail */
@@ -386,7 +386,7 @@
             LYD_OPT_OPAQ | LYD_VALOPT_DATA_ONLY, &tree));
     assert_null(tree);
 
-    lyp_free(out, NULL, 1);
+    ly_out_free(out, NULL, 1);
 
     *state = NULL;
 }
@@ -401,8 +401,8 @@
     struct lyd_node *tree, *op;
     const struct lyd_node *node;
 
-    struct lyp_out *out;
-    assert_non_null(out = lyp_new_memory(&str, 0));
+    struct ly_out *out;
+    assert_non_null(out = ly_out_new_memory(&str, 0));
 
     data =
         "<rpc xmlns=\"urn:ietf:params:xml:ns:netconf:base:1.0\" msgid=\"25\" custom-attr=\"val\">"
@@ -466,13 +466,13 @@
                 "</config>"
             "</edit-config>"
         "</rpc>");
-    lyp_out_reset(out);
+    ly_out_reset(out);
     lyd_free_all(tree);
 
     /* wrong namespace, element name, whatever... */
     /* TODO */
 
-    lyp_free(out, NULL, 1);
+    ly_out_free(out, NULL, 1);
 
     *state = NULL;
 }
@@ -487,8 +487,8 @@
     struct lyd_node *tree, *op;
     const struct lyd_node *node;
 
-    struct lyp_out *out;
-    assert_non_null(out = lyp_new_memory(&str, 0));
+    struct ly_out *out;
+    assert_non_null(out = ly_out_new_memory(&str, 0));
 
     data =
         "<rpc xmlns=\"urn:ietf:params:xml:ns:netconf:base:1.0\" msgid=\"25\" custom-attr=\"val\">"
@@ -525,13 +525,13 @@
                 "</c>"
             "</action>"
         "</rpc>");
-    lyp_out_reset(out);
+    ly_out_reset(out);
     lyd_free_all(tree);
 
     /* wrong namespace, element name, whatever... */
     /* TODO */
 
-    lyp_free(out, NULL, 1);
+    ly_out_free(out, NULL, 1);
 
     *state = NULL;
 }
@@ -546,8 +546,8 @@
     struct lyd_node *tree, *ntf;
     const struct lyd_node *node;
 
-    struct lyp_out *out;
-    assert_non_null(out = lyp_new_memory(&str, 0));
+    struct ly_out *out;
+    assert_non_null(out = ly_out_new_memory(&str, 0));
 
     data =
         "<notification xmlns=\"urn:ietf:params:xml:ns:netconf:notification:1.0\">"
@@ -578,7 +578,7 @@
 
     lyd_print(out, tree, LYD_XML, 0);
     assert_string_equal(str, data);
-    lyp_out_reset(out);
+    ly_out_reset(out);
     lyd_free_all(tree);
 
     /* top-level notif without envelope */
@@ -593,13 +593,13 @@
 
     lyd_print(out, tree, LYD_XML, 0);
     assert_string_equal(str, data);
-    lyp_out_reset(out);
+    ly_out_reset(out);
     lyd_free_all(tree);
 
     /* wrong namespace, element name, whatever... */
     /* TODO */
 
-    lyp_free(out, NULL, 1);
+    ly_out_free(out, NULL, 1);
 
     *state = NULL;
 }
@@ -614,8 +614,8 @@
     struct lyd_node *request, *tree, *op;
     const struct lyd_node *node;
 
-    struct lyp_out *out;
-    assert_non_null(out = lyp_new_memory(&str, 0));
+    struct ly_out *out;
+    assert_non_null(out = ly_out_new_memory(&str, 0));
 
     data =
         "<c xmlns=\"urn:tests:a\">"
@@ -650,13 +650,13 @@
     lyd_print(out, lyd_node_children(op), LYD_XML, 0);
     assert_string_equal(str,
         "<al xmlns=\"urn:tests:a\">25</al>");
-    lyp_out_reset(out);
+    ly_out_reset(out);
     lyd_free_all(tree);
 
     /* wrong namespace, element name, whatever... */
     /* TODO */
 
-    lyp_free(out, NULL, 1);
+    ly_out_free(out, NULL, 1);
 
     *state = NULL;
 }
diff --git a/tests/utests/data/test_printer_xml.c b/tests/utests/data/test_printer_xml.c
index 084ac2c..16e9e5c 100644
--- a/tests/utests/data/test_printer_xml.c
+++ b/tests/utests/data/test_printer_xml.c
@@ -176,10 +176,10 @@
     const char *result;
     char *printed;
     ssize_t len;
-    struct lyp_out *out;
+    struct ly_out *out;
 
     s->func = test_leaf;
-    assert_non_null(out = lyp_new_memory(&printed, 0));
+    assert_non_null(out = ly_out_new_memory(&printed, 0));
 
     data = "<int8 xmlns=\"urn:tests:types\">\n 15 \t\n  </int8>";
     result = "<int8 xmlns=\"urn:tests:types\">15</int8>";
@@ -189,7 +189,7 @@
     assert_string_equal(printed, result);
     lyd_free_all(tree);
 
-    lyp_free(out, NULL, 1);
+    ly_out_free(out, NULL, 1);
     s->func = NULL;
 }
 
@@ -201,10 +201,10 @@
     const char *data;
     char *printed;
     ssize_t len;
-    struct lyp_out *out;
+    struct ly_out *out;
 
     s->func = test_anydata;
-    assert_non_null(out = lyp_new_memory(&printed, 0));
+    assert_non_null(out = ly_out_new_memory(&printed, 0));
 
     data = "<any xmlns=\"urn:tests:types\"><somexml xmlns:x=\"url:x\" xmlns=\"example.com\"><x:x/></somexml></any>";
     assert_non_null(tree = lyd_parse_mem(s->ctx, data, LYD_XML, LYD_VALOPT_DATA_ONLY));
@@ -213,7 +213,7 @@
     /* canonized */
     data = "<any xmlns=\"urn:tests:types\"><somexml xmlns=\"example.com\"><x xmlns=\"url:x\"/></somexml></any>";
     assert_string_equal(printed, data);
-    lyp_out_reset(out);
+    ly_out_reset(out);
     lyd_free_all(tree);
 
     data = "<any xmlns=\"urn:tests:types\"/>";
@@ -221,7 +221,7 @@
     assert_true((len = lyd_print(out, tree, LYD_XML, 0)) >= 0);
     assert_int_equal(len, strlen(printed));
     assert_string_equal(printed, data);
-    lyp_out_reset(out);
+    ly_out_reset(out);
     lyd_free_all(tree);
 
     data =
@@ -253,11 +253,11 @@
             "</cont>"
         "</any>";
     assert_string_equal(printed, data);
-    lyp_out_reset(out);
+    ly_out_reset(out);
 
     lyd_free_all(tree);
 
-    lyp_free(out, NULL, 1);
+    ly_out_free(out, NULL, 1);
     s->func = NULL;
 }
 
@@ -269,11 +269,11 @@
     const char *data;
     char *printed;
     ssize_t len;
-    struct lyp_out *out;
+    struct ly_out *out;
 
     s->func = test_defaults;
 
-    assert_non_null(out = lyp_new_memory(&printed, 0));
+    assert_non_null(out = ly_out_new_memory(&printed, 0));
 
     /* standard default value */
     data = "<c xmlns=\"urn:defaults\">aa</c>";
@@ -282,13 +282,13 @@
     assert_true((len = lyd_print(out, tree, LYD_XML, LYDP_WITHSIBLINGS | LYDP_WD_TRIM)) >= 0);
     assert_int_equal(len, strlen(printed));
     assert_string_equal(printed, data);
-    lyp_out_reset(out);
+    ly_out_reset(out);
 
     assert_true((len = lyd_print(out, tree, LYD_XML, LYDP_WITHSIBLINGS | LYDP_WD_ALL)) >= 0);
     assert_int_equal(len, strlen(printed));
     data = "<c xmlns=\"urn:defaults\">aa</c><a xmlns=\"urn:defaults\" xmlns:d=\"urn:defaults\">/d:b</a>";
     assert_string_equal(printed, data);
-    lyp_out_reset(out);
+    ly_out_reset(out);
 
     assert_true((len = lyd_print(out, tree, LYD_XML, LYDP_WITHSIBLINGS | LYDP_WD_ALL_TAG)) >= 0);
     assert_int_equal(len, strlen(printed));
@@ -296,7 +296,7 @@
         "<a xmlns=\"urn:defaults\" xmlns:ncwd=\"urn:ietf:params:xml:ns:yang:ietf-netconf-with-defaults\""
         " ncwd:default=\"true\" xmlns:d=\"urn:defaults\">/d:b</a>";
     assert_string_equal(printed, data);
-    lyp_out_reset(out);
+    ly_out_reset(out);
 
     assert_true((len = lyd_print(out, tree, LYD_XML, LYDP_WITHSIBLINGS | LYDP_WD_IMPL_TAG)) >= 0);
     assert_int_equal(len, strlen(printed));
@@ -304,7 +304,7 @@
         "<a xmlns=\"urn:defaults\" xmlns:ncwd=\"urn:ietf:params:xml:ns:yang:ietf-netconf-with-defaults\""
         " ncwd:default=\"true\" xmlns:d=\"urn:defaults\">/d:b</a>";
     assert_string_equal(printed, data);
-    lyp_out_reset(out);
+    ly_out_reset(out);
 
     lyd_free_all(tree);
 
@@ -315,22 +315,22 @@
     assert_true((len = lyd_print(out, tree, LYD_XML, LYDP_WITHSIBLINGS | LYDP_WD_TRIM)) >= 0);
     assert_int_equal(len, strlen(printed));
     assert_string_equal(printed, data);
-    lyp_out_reset(out);
+    ly_out_reset(out);
 
     assert_true((len = lyd_print(out, tree, LYD_XML, LYDP_WITHSIBLINGS | LYDP_WD_ALL)) >= 0);
     assert_int_equal(len, strlen(printed));
     assert_string_equal(printed, data);
-    lyp_out_reset(out);
+    ly_out_reset(out);
 
     assert_true((len = lyd_print(out, tree, LYD_XML, LYDP_WITHSIBLINGS | LYDP_WD_ALL_TAG)) >= 0);
     assert_int_equal(len, strlen(printed));
     assert_string_equal(printed, data);
-    lyp_out_reset(out);
+    ly_out_reset(out);
 
     assert_true((len = lyd_print(out, tree, LYD_XML, LYDP_WITHSIBLINGS | LYDP_WD_IMPL_TAG)) >= 0);
     assert_int_equal(len, strlen(printed));
     assert_string_equal(printed, data);
-    lyp_out_reset(out);
+    ly_out_reset(out);
 
     lyd_free_all(tree);
 
@@ -342,13 +342,13 @@
     assert_int_equal(len, strlen(printed));
     data = "<c xmlns=\"urn:defaults\">aa</c><b xmlns=\"urn:defaults\">val</b>";
     assert_string_equal(printed, data);
-    lyp_out_reset(out);
+    ly_out_reset(out);
 
     assert_true((len = lyd_print(out, tree, LYD_XML, LYDP_WITHSIBLINGS | LYDP_WD_ALL)) >= 0);
     assert_int_equal(len, strlen(printed));
     data = "<c xmlns=\"urn:defaults\">aa</c><a xmlns=\"urn:defaults\" xmlns:d=\"urn:defaults\">/d:b</a><b xmlns=\"urn:defaults\">val</b>";
     assert_string_equal(printed, data);
-    lyp_out_reset(out);
+    ly_out_reset(out);
 
     assert_true((len = lyd_print(out, tree, LYD_XML, LYDP_WITHSIBLINGS | LYDP_WD_ALL_TAG)) >= 0);
     assert_int_equal(len, strlen(printed));
@@ -357,16 +357,16 @@
         " ncwd:default=\"true\" xmlns:d=\"urn:defaults\">/d:b</a>"
         "<b xmlns=\"urn:defaults\">val</b>";
     assert_string_equal(printed, data);
-    lyp_out_reset(out);
+    ly_out_reset(out);
 
     assert_true((len = lyd_print(out, tree, LYD_XML, LYDP_WITHSIBLINGS | LYDP_WD_IMPL_TAG)) >= 0);
     assert_int_equal(len, strlen(printed));
     data = "<c xmlns=\"urn:defaults\">aa</c><a xmlns=\"urn:defaults\" xmlns:d=\"urn:defaults\">/d:b</a><b xmlns=\"urn:defaults\">val</b>";
     assert_string_equal(printed, data);
-    lyp_out_reset(out);
+    ly_out_reset(out);
 
     lyd_free_all(tree);
-    lyp_free(out, NULL, 1);
+    ly_out_free(out, NULL, 1);
 
     s->func = NULL;
 }
@@ -384,10 +384,10 @@
     const char *reply, *result;
     char *printed;
     ssize_t len;
-    struct lyp_out *out;
+    struct ly_out *out;
 
     s->func = test_rpc;
-    assert_non_null(out = lyp_new_memory(&printed, 0));
+    assert_non_null(out = ly_out_new_memory(&printed, 0));
 
     request = "<sum xmlns=\"urn:tests:types\"><x>10</x><y>20</y></sum>";
     reply = "<result xmlns=\"urn:tests:types\">30</result>";
@@ -396,13 +396,13 @@
     assert_true((len = lyd_print(out, tree1, LYD_XML, 0)) >= 0);
     assert_int_equal(len, strlen(printed));
     assert_string_equal(printed, request);
-    lyp_out_reset(out);
+    ly_out_reset(out);
     assert_non_null(trees = lyd_trees_new(1, tree1));
     assert_non_null(tree2 = lyd_parse_mem(s->ctx, reply, LYD_XML, LYD_OPT_RPCREPLY, trees));
     assert_true((len = lyd_print(out, tree2, LYD_XML, 0)) >= 0);
     assert_int_equal(len, strlen(printed));
     assert_string_equal(printed, result);
-    lyp_out_reset(out);
+    ly_out_reset(out);
     lyd_trees_free(trees, 0);
     lyd_free_all(tree1);
     lyd_free_all(tree2);
@@ -415,13 +415,13 @@
     assert_true((len = lyd_print(out, tree1, LYD_XML, 0)) >= 0);
     assert_int_equal(len, strlen(printed));
     assert_string_equal(printed, request);
-    lyp_out_reset(out);
+    ly_out_reset(out);
     assert_non_null(trees = lyd_trees_new(1, tree1));
     assert_non_null(tree2 = lyd_parse_mem(s->ctx, reply, LYD_XML, LYD_OPT_RPCREPLY, trees));
     assert_true((len = lyd_print(out, tree2, LYD_XML, 0)) >= 0);
     assert_int_equal(len, strlen(printed));
     assert_string_equal(printed, result);
-    lyp_out_reset(out);
+    ly_out_reset(out);
     lyd_trees_free(trees, 0);
     lyd_free_all(tree1);
     lyd_free_all(tree2);
@@ -439,18 +439,18 @@
     assert_true((len = lyd_print(out, tree1, LYD_XML, 0)) >= 0);
     assert_int_equal(len, strlen(printed));
     assert_string_equal(printed, request);
-    lyp_out_reset(out);
+    ly_out_reset(out);
     assert_non_null(trees = lyd_trees_new(1, tree1));
     assert_non_null(tree2 = lyd_parse_mem(s->ctx, reply, LYD_XML, LYD_OPT_RPCREPLY, trees));
     assert_true((len = lyd_print(out, tree2, LYD_XML, 0)) >= 0);
     assert_int_equal(len, strlen(printed));
     assert_string_equal(printed, result);
-    lyp_out_reset(out);
+    ly_out_reset(out);
     lyd_trees_free(trees, 0);
     lyd_free_all(tree1);
     lyd_free_all(tree2);
 
-    lyp_free(out, NULL, 1);
+    ly_out_free(out, NULL, 1);
     s->func = NULL;
 }
 
diff --git a/tests/utests/data/test_validation.c b/tests/utests/data/test_validation.c
index 16d742a..fde40de 100644
--- a/tests/utests/data/test_validation.c
+++ b/tests/utests/data/test_validation.c
@@ -1019,8 +1019,8 @@
     struct lyd_node *tree, *node;
     const struct lys_module *mod = ly_ctx_get_module_latest(ctx, "f");
 
-    struct lyp_out *out;
-    assert_non_null(out = lyp_new_memory(&str, 0));
+    struct ly_out *out;
+    assert_non_null(out = ly_out_new_memory(&str, 0));
 
     /* get defaults */
     tree = NULL;
@@ -1044,7 +1044,7 @@
             "<ll2 xmlns:ncwd=\"urn:ietf:params:xml:ns:yang:ietf-netconf-with-defaults\" ncwd:default=\"true\">dflt1</ll2>"
             "<ll2 xmlns:ncwd=\"urn:ietf:params:xml:ns:yang:ietf-netconf-with-defaults\" ncwd:default=\"true\">dflt2</ll2>"
         "</cont>");
-    lyp_out_reset(out);
+    ly_out_reset(out);
 
     /* create another explicit case and validate */
     node = lyd_new_term(NULL, mod, "l", "value");
@@ -1067,7 +1067,7 @@
             "<ll2 xmlns:ncwd=\"urn:ietf:params:xml:ns:yang:ietf-netconf-with-defaults\" ncwd:default=\"true\">dflt2</ll2>"
         "</cont>"
         "<l xmlns=\"urn:tests:f\">value</l>");
-    lyp_out_reset(out);
+    ly_out_reset(out);
 
     /* create explicit leaf-list and leaf and validate */
     node = lyd_new_term(NULL, mod, "d", "15");
@@ -1092,7 +1092,7 @@
         "<l xmlns=\"urn:tests:f\">value</l>"
         "<d xmlns=\"urn:tests:f\">15</d>"
         "<ll2 xmlns=\"urn:tests:f\">dflt2</ll2>");
-    lyp_out_reset(out);
+    ly_out_reset(out);
 
     /* create first explicit container, which should become implicit */
     node = lyd_new_inner(NULL, mod, "cont");
@@ -1115,7 +1115,7 @@
         "<l xmlns=\"urn:tests:f\">value</l>"
         "<d xmlns=\"urn:tests:f\">15</d>"
         "<ll2 xmlns=\"urn:tests:f\">dflt2</ll2>");
-    lyp_out_reset(out);
+    ly_out_reset(out);
 
     /* create second explicit container, which should become implicit, so the first tree node should be removed */
     node = lyd_new_inner(NULL, mod, "cont");
@@ -1137,7 +1137,7 @@
         "<l xmlns=\"urn:tests:f\">value</l>"
         "<d xmlns=\"urn:tests:f\">15</d>"
         "<ll2 xmlns=\"urn:tests:f\">dflt2</ll2>");
-    lyp_out_reset(out);
+    ly_out_reset(out);
 
     /* similar changes for nested defaults */
     assert_non_null(lyd_new_term(tree, NULL, "ll1", "def3"));
@@ -1156,10 +1156,10 @@
         "<l xmlns=\"urn:tests:f\">value</l>"
         "<d xmlns=\"urn:tests:f\">15</d>"
         "<ll2 xmlns=\"urn:tests:f\">dflt2</ll2>");
-    lyp_out_reset(out);
+    ly_out_reset(out);
 
     lyd_free_siblings(tree);
-    lyp_free(out, NULL, 1);
+    ly_out_free(out, NULL, 1);
 
     *state = NULL;
 }
diff --git a/tests/utests/schema/test_printer_yang.c b/tests/utests/schema/test_printer_yang.c
index 93e3aeb..a8d5241 100644
--- a/tests/utests/schema/test_printer_yang.c
+++ b/tests/utests/schema/test_printer_yang.c
@@ -131,19 +131,19 @@
             "    \"some reference\";\n"
             "}\n";
     char *printed;
-    struct lyp_out *out;
+    struct ly_out *out;
     size_t size = 0;
 
-    assert_non_null(out = lyp_new_memory(&printed, 0));
+    assert_non_null(out = ly_out_new_memory(&printed, 0));
     assert_int_equal(LY_SUCCESS, ly_ctx_new(NULL, 0, &ctx));
 
     assert_non_null(mod = lys_parse_mem(ctx, orig, LYS_IN_YANG));
     assert_int_equal(strlen(orig), size = lys_print(out, mod, LYS_OUT_YANG, 0, 0));
     assert_string_equal(printed, orig);
-    lyp_out_reset(out);
+    ly_out_reset(out);
     assert_int_equal(strlen(compiled), lys_print(out, mod, LYS_OUT_YANG_COMPILED, 0, 0));
     assert_string_equal(printed, compiled);
-    lyp_out_reset(out);
+    ly_out_reset(out);
 
     orig = "module b {\n"
             "  yang-version 1.1;\n"
@@ -189,10 +189,10 @@
     assert_non_null(mod = lys_parse_mem(ctx, orig, LYS_IN_YANG));
     assert_int_equal(strlen(orig), lys_print(out, mod, LYS_OUT_YANG, 0, 0));
     assert_string_equal(printed, orig);
-    lyp_out_reset(out);
+    ly_out_reset(out);
     assert_int_equal(strlen(compiled), lys_print(out, mod, LYS_OUT_YANG_COMPILED, 0, 0));
     assert_string_equal(printed, compiled);
-    lyp_out_reset(out);
+    ly_out_reset(out);
 
     orig = compiled ="module c {\n"
             "  yang-version 1.1;\n"
@@ -214,13 +214,13 @@
     assert_non_null(mod = lys_parse_mem(ctx, orig, LYS_IN_YANG));
     assert_int_equal(strlen(orig), lys_print(out, mod, LYS_OUT_YANG, 0, 0));
     assert_string_equal(printed, orig);
-    lyp_out_reset(out);
+    ly_out_reset(out);
     assert_int_equal(strlen(compiled), lys_print(out, mod, LYS_OUT_YANG, 0, 0));
     assert_string_equal(printed, compiled);
     /* missing free(printed); which is done in the following lyp_free() */
 
     *state = NULL;
-    lyp_free(out, NULL, 1);
+    ly_out_free(out, NULL, 1);
     ly_ctx_destroy(ctx, NULL);
 }
 
diff --git a/tests/utests/schema/test_printer_yin.c b/tests/utests/schema/test_printer_yin.c
index 5656795..9dbec76 100644
--- a/tests/utests/schema/test_printer_yin.c
+++ b/tests/utests/schema/test_printer_yin.c
@@ -579,9 +579,9 @@
             "</module>\n";
 
     char *printed;
-    struct lyp_out *out;
+    struct ly_out *out;
 
-    assert_non_null(out = lyp_new_memory(&printed, 0));
+    assert_non_null(out = ly_out_new_memory(&printed, 0));
     assert_int_equal(LY_SUCCESS, ly_ctx_new(NULL, 0, &ctx));
 
     assert_non_null(mod = lys_parse_mem(ctx, orig, LYS_IN_YANG));
@@ -598,7 +598,7 @@
     free(printed);
 
     *state = NULL;
-    lyp_free(out, NULL, 0);
+    ly_out_free(out, NULL, 0);
     ly_ctx_destroy(ctx, NULL);
 }
 
diff --git a/tools/lint/commands.c b/tools/lint/commands.c
index d82e6e9..524eabb 100644
--- a/tools/lint/commands.c
+++ b/tools/lint/commands.c
@@ -346,7 +346,7 @@
     const char *out_path = NULL, *target_path = NULL;
     const struct lys_module *module;
     LYS_OUTFORMAT format = LYS_OUT_TREE;
-    struct lyp_out *out = NULL;
+    struct ly_out *out = NULL;
     static struct option long_options[] = {
         {"help", no_argument, 0, 'h'},
         {"format", required_argument, 0, 'f'},
@@ -494,9 +494,9 @@
     }
 
     if (out_path) {
-        out = lyp_new_filepath(out_path);
+        out = ly_out_new_filepath(out_path);
     } else {
-        out = lyp_new_file(stdout);
+        out = ly_out_new_file(stdout);
     }
     if (!out) {
         fprintf(stderr, "Could not open the output file (%s).\n", strerror(errno));
@@ -518,7 +518,7 @@
     free(*argv);
     free(argv);
 
-    lyp_free(out, NULL, out_path ? 1 : 0);
+    ly_out_free(out, NULL, out_path ? 1 : 0);
 
     return ret;
 }
@@ -700,7 +700,7 @@
     struct lyd_node *tree = NULL;
     const struct lyd_node **trees = NULL;
     LYD_FORMAT outformat = 0;
-    struct lyp_out *out = NULL;
+    struct ly_out *out = NULL;
     static struct option long_options[] = {
         {"defaults", required_argument, 0, 'd'},
         {"help", no_argument, 0, 'h'},
@@ -835,9 +835,9 @@
     }
 
     if (out_path) {
-        out = lyp_new_filepath(out_path);
+        out = ly_out_new_filepath(out_path);
     } else {
-        out = lyp_new_file(stdout);
+        out = ly_out_new_file(stdout);
     }
     if (!out) {
         fprintf(stderr, "Could not open the output file (%s).\n", strerror(errno));
@@ -854,7 +854,7 @@
     free(*argv);
     free(argv);
 
-    lyp_free(out, NULL, out_path ? 1 : 0);
+    ly_out_free(out, NULL, out_path ? 1 : 0);
 
     lyd_free_all(data);
 
diff --git a/tools/lint/main_ni.c b/tools/lint/main_ni.c
index 7a16b62..67bd6ae 100644
--- a/tools/lint/main_ni.c
+++ b/tools/lint/main_ni.c
@@ -301,7 +301,7 @@
         {NULL,               required_argument, NULL, 'y'},
         {NULL,               0,                 NULL, 0}
     };
-    struct lyp_out *out = NULL;
+    struct ly_out *out = NULL;
     struct ly_ctx *ctx = NULL;
     const struct lys_module *mod;
     LYS_OUTFORMAT outformat_s = 0;
@@ -472,12 +472,12 @@
 #endif
         case 'o':
             if (out) {
-                if (lyp_filepath(out, optarg) != NULL) {
+                if (ly_out_filepath(out, optarg) != NULL) {
                     fprintf(stderr, "yanglint error: unable open output file %s (%s)\n", optarg, strerror(errno));
                     goto cleanup;
                 }
             } else {
-                out = lyp_new_filepath(optarg);
+                out = ly_out_new_filepath(optarg);
                 if (!out) {
                     fprintf(stderr, "yanglint error: unable open output file %s (%s)\n", optarg, strerror(errno));
                     goto cleanup;
@@ -775,7 +775,7 @@
         } else {
             for (u = 0; u < mods->count; u++) {
                 if (u) {
-                    lyp_print(out, "\n");
+                    ly_print(out, "\n");
                 }
                 lys_print(out, (struct lys_module *)mods->objs[u], outformat_s, outline_length_s, outoptions_s);
             }
@@ -1093,6 +1093,6 @@
     }
     ly_ctx_destroy(ctx, NULL);
 
-    lyp_free(out, NULL, 1);
+    ly_out_free(out, NULL, 1);
     return ret;
 }