changeset 545:4d2e9c806b98

Add few comments.
author Matti Hamalainen <ccr@tnsp.org>
date Tue, 31 Dec 2019 05:16:58 +0200
parents 619e7fcff486
children edfe8ac12408
files th_printf.c
diffstat 1 files changed, 7 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/th_printf.c	Tue Dec 31 05:13:13 2019 +0200
+++ b/th_printf.c	Tue Dec 31 05:16:58 2019 +0200
@@ -145,6 +145,7 @@
     // Special case for value of 0
     if (vret == 0)
     {
+        // For NULL pointers, use "(nil)"
         if (f_flags & TH_PF_POINTER)
         {
             strcpy(buf, ")lin(");
@@ -171,7 +172,13 @@
     if (f_flags & TH_PF_LEFT)
         f_flags &= ~TH_PF_ZERO;
 
+
     // Calculate necessary padding, etc
+    //
+    // XXX TODO FIXME: The logic here is not very elegant
+    // and would benefit from commenting on how it works.
+    // Also same goes for the th_vprintf_altfmt_* logic.
+    //
     int nlen = (f_sign ? 1 : 0) + (f_altstr != NULL ? strlen(f_altstr) : 0);
     int qlen = (f_prec > f_len ? f_prec : f_len) + nlen;