]> mj.ucw.cz Git - libucw.git/commitdiff
Mempools: Renamed mp_append_[v]printf() back to its original name
authorMartin Mares <mj@ucw.cz>
Thu, 9 Apr 2015 13:49:56 +0000 (15:49 +0200)
committerMartin Mares <mj@ucw.cz>
Thu, 9 Apr 2015 13:49:56 +0000 (15:49 +0200)
maint/libucw.abi
ucw/doc/relnotes.txt
ucw/mempool-fmt.c
ucw/mempool.h

index 299c06d49ae7cc8a845c6039bae0e8369f86e6e1..b103e5840a9fe7640e5ebfd2ad113bc6c342d3f7 100644 (file)
@@ -389,8 +389,8 @@ mp_strjoin
 mp_str_from_mem
 mp_printf
 mp_vprintf
-mp_append_printf
-mp_append_vprintf
+mp_printf_append
+mp_vprintf_append
 # ucw/opt-internal.h
 opt_precompute
 # ucw/opt.h
index 888edf96938e404b752838af0d902297f2270bb5..1098499e800104478be46ba51650e1d5e59dab37 100644 (file)
@@ -1,6 +1,14 @@
 Release notes
 =============
 
+FIXME
+-----
+* The naming of memory pool functions mp_append_printf() and mp_append_vprintf()
+  turned out to be unfortunate as they have differently from all other functions
+  operating on growing buffers. They have been renamed to mp_printf_append()
+  and mp_vprintf_append() with the old names kept as aliases for backward
+  compatibility.
+
 6.4 (2015-04-08)
 ----------------
 * Fixed several minor bugs in the <<mainloop:,mainloop>> module.
index 1b98a2d39df9d5ffabac8f6b17b983fc9f585271..7dc7a10d68ae45eddacf67a7f065be92cf196f2f 100644 (file)
@@ -65,7 +65,7 @@ mp_printf(struct mempool *p, const char *fmt, ...)
 }
 
 char *
-mp_append_vprintf(struct mempool *mp, char *ptr, const char *fmt, va_list args)
+mp_vprintf_append(struct mempool *mp, char *ptr, const char *fmt, va_list args)
 {
   size_t ofs = mp_open(mp, ptr);
   ASSERT(ofs && !ptr[ofs - 1]);
@@ -73,7 +73,7 @@ mp_append_vprintf(struct mempool *mp, char *ptr, const char *fmt, va_list args)
 }
 
 char *
-mp_append_printf(struct mempool *mp, char *ptr, const char *fmt, ...)
+mp_printf_append(struct mempool *mp, char *ptr, const char *fmt, ...)
 {
   va_list args;
   va_start(args, fmt);
@@ -89,7 +89,7 @@ int main(void)
   struct mempool *mp = mp_new(64);
   char *x = mp_printf(mp, "<Hello, %s!>", "World");
   fputs(x, stdout);
-  x = mp_append_printf(mp, x, "<Appended>");
+  x = mp_printf_append(mp, x, "<Appended>");
   fputs(x, stdout);
   x = mp_printf(mp, "<Hello, %50s!>\n", "World");
   fputs(x, stdout);
index 0f043d602c1d07f54d780be949def05c08fc8b34..44595ea7faa8432421f02a103d952b271c80943c 100644 (file)
@@ -1,7 +1,7 @@
 /*
  *     UCW Library -- Memory Pools
  *
- *     (c) 1997--2014 Martin Mares <mj@ucw.cz>
+ *     (c) 1997--2015 Martin Mares <mj@ucw.cz>
  *     (c) 2007 Pavel Charvat <pchar@ucw.cz>
  *
  *     This software may be freely distributed and used according to the terms
@@ -19,8 +19,6 @@
 #define mp_alloc_internal ucw_mp_alloc_internal
 #define mp_alloc_noalign ucw_mp_alloc_noalign
 #define mp_alloc_zero ucw_mp_alloc_zero
-#define mp_append_printf ucw_mp_append_printf
-#define mp_append_vprintf ucw_mp_append_vprintf
 #define mp_delete ucw_mp_delete
 #define mp_flush ucw_mp_flush
 #define mp_grow_internal ucw_mp_grow_internal
@@ -31,6 +29,7 @@
 #define mp_open ucw_mp_open
 #define mp_pop ucw_mp_pop
 #define mp_printf ucw_mp_printf
+#define mp_printf_append ucw_mp_printf_append
 #define mp_push ucw_mp_push
 #define mp_realloc ucw_mp_realloc
 #define mp_realloc_zero ucw_mp_realloc_zero
@@ -46,6 +45,7 @@
 #define mp_strjoin ucw_mp_strjoin
 #define mp_total_size ucw_mp_total_size
 #define mp_vprintf ucw_mp_vprintf
+#define mp_vprintf_append ucw_mp_vprintf_append
 #endif
 
 /***
@@ -542,18 +542,22 @@ char *mp_vprintf(struct mempool *mp, const char *fmt, va_list args) LIKE_MALLOC;
  * Returns pointer to the beginning of the string (the pointer may have
  * changed due to reallocation).
  *
- * Alternatively, this function may be called mp_printf_append() for compatibility with
- * previous releases of LibUCW.
+ * In some versions of LibUCW, this function was called mp_append_printf(). However,
+ * this name turned out to be confusing -- unlike other appending functions, this one is
+ * not called on an opened growing buffer. The old name will be preserved for backward
+ * compatibility for the time being.
  **/
-char *mp_append_printf(struct mempool *mp, char *ptr, const char *fmt, ...) FORMAT_CHECK(printf,3,4);
-#define mp_printf_append mp_append_printf
+char *mp_printf_append(struct mempool *mp, char *ptr, const char *fmt, ...) FORMAT_CHECK(printf,3,4);
+#define mp_append_printf mp_printf_append
 /**
- * Like @mp_append_printf(), but uses `va_list` for parameters.
+ * Like @mp_printf_append(), but uses `va_list` for parameters.
  *
- * Alternatively, this function may be called mp_vprintf_append() for compatibility with
- * previous releases of LibUCW.
+ * In some versions of LibUCW, this function was called mp_append_vprintf(). However,
+ * this name turned out to be confusing -- unlike other appending functions, this one is
+ * not called on an opened growing buffer. The old name will be preserved for backward
+ * compatibility for the time being.
  **/
-char *mp_append_vprintf(struct mempool *mp, char *ptr, const char *fmt, va_list args);
-#define mp_vprintf_append mp_append_vprintf
+char *mp_vprintf_append(struct mempool *mp, char *ptr, const char *fmt, va_list args);
+#define mp_append_vprintf mp_vprintf_append
 
 #endif