summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--nuttx/TODO8
-rw-r--r--nuttx/lib/stdio/lib_asprintf.c10
2 files changed, 15 insertions, 3 deletions
diff --git a/nuttx/TODO b/nuttx/TODO
index 553c79ec2..475263727 100644
--- a/nuttx/TODO
+++ b/nuttx/TODO
@@ -1,4 +1,4 @@
-NuttX TODO List (Last updated May 28, 2011)
+NuttX TODO List (Last updated May 31, 2011)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
nuttx/
@@ -12,7 +12,7 @@ nuttx/
(5) Binary loaders (binfmt/)
(15) Network (net/, drivers/net)
(2) USB (drivers/usbdev, drivers/usbhost)
- (5) Libraries (lib/)
+ (6) Libraries (lib/)
(13) File system/Generic drivers (fs/, drivers/)
(1) Graphics subystem (graphics/)
(1) Pascal add-on (pcode/)
@@ -386,6 +386,10 @@ o Libraries (lib/)
Status: Open
Priority: Low
+ Description: Not implemented: ferror() and clearerr()
+ Status: Open
+ Priority: Low
+
o File system / Generic drivers (fs/, drivers/)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
diff --git a/nuttx/lib/stdio/lib_asprintf.c b/nuttx/lib/stdio/lib_asprintf.c
index 2baffe1ac..42467e71d 100644
--- a/nuttx/lib/stdio/lib_asprintf.c
+++ b/nuttx/lib/stdio/lib_asprintf.c
@@ -101,6 +101,8 @@ int asprintf (FAR char **ptr, const char *fmt, ...)
va_list ap;
int n;
+ DEBUGASSERT(ptr && fmt);
+
/* First, use a nullstream to get the size of the buffer */
lib_nulloutstream(&nulloutstream);
@@ -121,13 +123,19 @@ int asprintf (FAR char **ptr, const char *fmt, ...)
lib_memoutstream((FAR struct lib_memoutstream_s *)&memoutstream,
buf, nulloutstream.nput);
- /* Then let lib_vsprintf do it real thing */
+ /* Then let lib_vsprintf do it's real thing */
va_start(ap, fmt);
n = lib_vsprintf((FAR struct lib_outstream_s *)&memoutstream.public, fmt, ap);
va_end(ap);
+ /* Terminate the string and return a pointer to the string to the caller.
+ * Hmmm.. looks like the memory would be stranded if lib_vsprintf() returned
+ * an error. Does that ever happen?
+ */
+
DEBUGASSERT(n < 0 || n == nulloutstream.nput);
buf[nulloutstream.nput] = '\0';
+ *ptr = buf;
return n;
}