1 http://sourceware.org/ml/gdb-patches/2011-04/msg00124.html
2 Subject: [patch 1/3] case insensitive: Reformat code
6 just some reformatting to make the later patch more clear. There should be no
7 functionality difference by this patch. c1+c2 are a bit ugly but I found any
8 other solution a bit ugly.
16 2011-04-08 Jan Kratochvil <jan.kratochvil@redhat.com>
18 Format the code for the next patch.
19 * dwarf2read.c (struct mapped_index): Include delimiting newlines.
20 * utils.c (strcmp_iw_ordered): Reformat the code for the next patch.
21 New variables c1 and c2.
23 --- a/gdb/dwarf2read.c
24 +++ b/gdb/dwarf2read.c
25 @@ -150,14 +150,19 @@ struct mapped_index
27 /* The total length of the buffer. */
30 /* A pointer to the address table data. */
31 const gdb_byte *address_table;
33 /* Size of the address table data in bytes. */
34 offset_type address_table_size;
36 /* The symbol table, implemented as a hash table. */
37 const offset_type *symbol_table;
39 /* Size in slots, each slot is 2 offset_types. */
40 offset_type symbol_table_slots;
42 /* A pointer to the constant pool. */
43 const char *constant_pool;
47 @@ -3023,48 +3023,55 @@ strcmp_iw (const char *string1, const char *string2)
49 strcmp_iw_ordered (const char *string1, const char *string2)
51 - while ((*string1 != '\0') && (*string2 != '\0'))
52 + /* Formatting stub. */
55 - while (isspace (*string1))
59 - while (isspace (*string2))
63 - if (*string1 != *string2)
64 + /* C1 and C2 are valid only if *string1 != '\0' && *string2 != '\0'.
65 + Provide stub characters if we are already at the end of one of the
67 + char c1 = 'X', c2 = 'X';
69 + while (*string1 != '\0' && *string2 != '\0')
72 + while (isspace (*string1))
74 + while (isspace (*string2))
82 + if (*string1 != '\0')
88 - if (*string1 != '\0')
94 + /* Characters are non-equal unless they're both '\0'; we want to
95 + make sure we get the comparison right according to our
96 + comparison in the cases where one of them is '\0' or '('. */
98 + if (*string2 == '\0')
103 + if (*string2 == '\0')
108 + if (*string2 == '\0' || *string2 == '(')
117 - /* Characters are non-equal unless they're both '\0'; we want to
118 - make sure we get the comparison right according to our
119 - comparison in the cases where one of them is '\0' or '('. */
121 - if (*string2 == '\0')
126 - if (*string2 == '\0')
131 - if (*string2 == '(')
134 - return *string1 - *string2;
138 /* A simple comparison function with opposite semantics to strcmp. */