RSS-Client: add missing locks
[citadel.git] / citadel / snprintf.c
index 693a2592e80fb9c591b8982be6032b60dc5c93a9..ad04a02e23a7230419a869dfcd67e8448944409d 100644 (file)
@@ -1,11 +1,9 @@
-/*
- * modified from Sten Gunterberg's BUGTRAQ post of 22 Jul 1997
- * --nathan bryant <bryant@cs.usm.maine.edu>
- */
-
 /*
  * Replacements for snprintf() and vsnprintf()
  *
+ * modified from Sten Gunterberg's BUGTRAQ post of 22 Jul 1997
+ * --nathan bryant <nathan@designtrust.com>
+ *
  * Use it only if you have the "spare" cycles needed to effectively
  * do every snprintf operation twice! Why is that? Because everything
  * is first vfprintf()'d to /dev/null to determine the number of bytes.
@@ -46,19 +44,6 @@ needed (const char *fmt, va_list argp)
   return vfprintf(sink, fmt, argp);
 }
 
-int
-snprintf (char *buf, size_t max, const char *fmt, ...)
-{
-  va_list argp;
-  int bytes;
-
-  va_start(argp, fmt);
-  bytes = vsnprintf(buf, max, fmt, argp);
-  va_end(argp);
-
-  return bytes;
-}
-
 int
 vsnprintf (char *buf, size_t max, const char *fmt, va_list argp)
 {
@@ -79,3 +64,16 @@ vsnprintf (char *buf, size_t max, const char *fmt, va_list argp)
   free(p);
   return size;
 }
+
+int
+snprintf (char *buf, size_t max, const char *fmt, ...)
+{
+  va_list argp;
+  int bytes;
+
+  va_start(argp, fmt);
+  bytes = vsnprintf(buf, max, fmt, argp);
+  va_end(argp);
+
+  return bytes;
+}