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 2/2] time/tst-strptime2.c: test full input range +/- 0-9999


On Sun, Aug 16, 2015 at 7:31 AM, Mike Frysinger <vapier@gentoo.org> wrote:
> On 15 Aug 2015 12:42, James Perkins wrote:
>> +static const char const *dummy_string = "1113472456";
>
> the double const here doesn't make sense.  maybe you meant:
>         static const char * const dummy_string = ...;
>
> but really it looks like you want:
>         static const char dummy_string[] = ...;

Thanks for the feedback, Mike. You are correct, I'll change that as you suggest:

-static const char const *dummy_string = "1113472456";
+static const char dummy_string[] = "1113472456";


>> +      extern bool verbose; \
>
> you shouldn't need this since the code is all included below
>
>> +      verbose = 1; \

You're right, it is an extraneous leftover from my early --verbose experimenting
which needs to be cleaned up, like so:

-    { \
-      extern bool verbose; \
-      verbose = 1; \
-    } \
+    verbose = 1; \


> verbose is a bool, so only use true & false.

After looking at carefully converting bool typed variables true and false values
explicitly to 1 and 0 where int is needed, I'm starting to think that
dropping the bool
type and just using int will result in more concise and maintainable code.
This will change the V5 tst-strptime2.c like this:

-#include <stdbool.h>
...
-static bool verbose;
+static int verbose;
...
 static long int
-mkbuf (char *buf, bool neg, unsigned int hhmm, size_t ndigits)
+mkbuf (char *buf, int neg, unsigned int hhmm, size_t ndigits)
 ...
 static void
-describe (bool string_valid, long int tm_gmtoff)
+describe (int string_valid, long int tm_gmtoff)
...
-  bool fail;
+  int fail;
...
-      bool expect_string_valid = (expect == LONG_MAX) ? 0 : 1;
+      int expect_string_valid = (expect == LONG_MAX) ? 0 : 1;
...
-         bool test_string_valid = retval ? 1 : 0;
+         int test_string_valid = retval ? 1 : 0;

I'm going to hold a day or two to hear from Carlos first, then post a
new patchset
with the above change.

Cheers,
James


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