diff options
author | Christian Grothoff <christian@grothoff.org> | 2009-09-25 22:10:51 +0000 |
---|---|---|
committer | Christian Grothoff <christian@grothoff.org> | 2009-09-25 22:10:51 +0000 |
commit | f1b9c5c115139b02cac1cae4f053792e1e5b1ccb (patch) | |
tree | cd9047d73ba498d05f67c7e06ae4bd5ed89511e7 /src/util/common_allocation.c | |
parent | c2d3d24cd9b4f552d7ca8ad6283f9819c1cfefc7 (diff) | |
download | gnunet-f1b9c5c115139b02cac1cae4f053792e1e5b1ccb.tar.gz gnunet-f1b9c5c115139b02cac1cae4f053792e1e5b1ccb.zip |
improving style and docs
Diffstat (limited to 'src/util/common_allocation.c')
-rw-r--r-- | src/util/common_allocation.c | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/src/util/common_allocation.c b/src/util/common_allocation.c index 749f824cd..2f78c98f6 100644 --- a/src/util/common_allocation.c +++ b/src/util/common_allocation.c | |||
@@ -171,6 +171,14 @@ GNUNET_xgrow_ (void **old, | |||
171 | } | 171 | } |
172 | 172 | ||
173 | 173 | ||
174 | /** | ||
175 | * Like asprintf, just portable. | ||
176 | * | ||
177 | * @param buf set to a buffer of sufficient size (allocated, caller must free) | ||
178 | * @param format format string (see printf, fprintf, etc.) | ||
179 | * @param ... data for format string | ||
180 | * @return number of bytes in "*buf" excluding 0-termination | ||
181 | */ | ||
174 | int | 182 | int |
175 | GNUNET_asprintf (char **buf, const char *format, ...) | 183 | GNUNET_asprintf (char **buf, const char *format, ...) |
176 | { | 184 | { |
@@ -187,6 +195,16 @@ GNUNET_asprintf (char **buf, const char *format, ...) | |||
187 | return ret; | 195 | return ret; |
188 | } | 196 | } |
189 | 197 | ||
198 | |||
199 | /** | ||
200 | * Like snprintf, just aborts if the buffer is of insufficient size. | ||
201 | * | ||
202 | * @param buf pointer to buffer that is written to | ||
203 | * @param size number of bytes in buf | ||
204 | * @param format format strings | ||
205 | * @param ... data for format string | ||
206 | * @return number of bytes written to buf or negative value on error | ||
207 | */ | ||
190 | int | 208 | int |
191 | GNUNET_snprintf (char *buf, size_t size, const char *format, ...) | 209 | GNUNET_snprintf (char *buf, size_t size, const char *format, ...) |
192 | { | 210 | { |