This is the mail archive of the libc-alpha@sourceware.org mailing list for the glibc project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [PATCH] strftime incorrectly combines flags


Three things.

1.  The swap-case flag isn't documented, so this patch is fixing
    a bug in documented behavior.  Shouldn't the flag be documented?

2.  I don't see how the patch fixes the %p and %P formats, e.g.,
    %^P, %#P, %^#P.  Admittedly the code may already be buggy there.

3.  For a patch like this:

-	  if (change_case)
+	  if (change_case && (to_uppcase ^ to_lowcase))
 	    {
-	      to_uppcase = 1;
-	      to_lowcase = 0;
+	      to_uppcase = !to_uppcase;
+	      to_lowcase = !to_lowcase;
 	    }

   to_lowcase is known to be zero before
   the above code is executed, so there's opportunity for
   simplification here.   How about omitting the 'if' entirely,
   and replacing it with something like this?

	  to_lowcase = change_case & to_uppcase;
	  to_uppcase ^= change_case;


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]