chiark / gitweb /
Source code reorganization:
[disorder] / lib / asprintf.c
index 3abe0dbe7e034d0144ed8605936f44bac405b7ba..7d7bd315e541f7e0a4de5b559953d8c05a82ed1c 100644 (file)
@@ -1,6 +1,6 @@
 /*
  * This file is part of DisOrder
- * Copyright (C) 2004, 2006 Richard Kettlewell
+ * Copyright (C) 2004-2008 Richard Kettlewell
  *
  * This program is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
  * USA
  */
+/** @file lib/asprintf.c @brief printf() workalikes */
 
-#include <config.h>
-#include "types.h"
+#include "common.h"
 
-#include <stdio.h>
-#include <string.h>
 #include <stdarg.h>
 #include <stddef.h>
 #include <errno.h>
 #include "vector.h"
 #include "log.h"
 
+/** @brief vasprintf() workalike without encoding errors
+ *
+ * This acts like vasprintf() except that it does not throw an error
+ * if you use a string outside the current locale's encoding rules,
+ * and it uses the memory allocation calls from @ref mem.h.
+ */
 int byte_vasprintf(char **ptrp,
                   const char *fmt,
                   va_list ap) {
@@ -47,6 +51,12 @@ int byte_vasprintf(char **ptrp,
   return n;
 }
 
+/** @brief asprintf() workalike without encoding errors
+ *
+ * This acts like asprintf() except that it does not throw an error
+ * if you use a string outside the current locale's encoding rules,
+ * and it uses the memory allocation calls from @ref mem.h.
+ */
 int byte_asprintf(char **ptrp,
                  const char *fmt,
                  ...) {
@@ -59,6 +69,13 @@ int byte_asprintf(char **ptrp,
   return n;
 }
 
+/** @brief asprintf() workalike without encoding errors
+ *
+ * This acts like asprintf() except that it does not throw an error if
+ * you use a string outside the current locale's encoding rules; it
+ * uses the memory allocation calls from @ref mem.h; and it terminates
+ * the program on error.
+ */
 int byte_xasprintf(char **ptrp,
                   const char *fmt,
                   ...) {
@@ -71,6 +88,13 @@ int byte_xasprintf(char **ptrp,
   return n;
 }
 
+/** @brief vasprintf() workalike without encoding errors
+ *
+ * This acts like vasprintf() except that it does not throw an error
+ * if you use a string outside the current locale's encoding rules; it
+ * uses the memory allocation calls from @ref mem.h; and it terminates
+ * the program on error.
+ */
 int byte_xvasprintf(char **ptrp,
                    const char *fmt,
                    va_list ap) {
@@ -87,4 +111,3 @@ c-basic-offset:2
 comment-column:40
 End:
 */
-/* arch-tag:39488c5fd6a6d176e613e7e747e55628 */