From: Andrew Cagney Date: Thu, 6 Nov 2003 22:54:02 +0000 (+0000) Subject: 2003-11-06 Andrew Cagney X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=bf896cb059775f7c8a68e13a733191755fdc1a85;p=binutils-gdb.git 2003-11-06 Andrew Cagney * valops.c (destructor_name_p): Replace STREQN with strncmp. * top.c (command_line_input): Ditto. * objc-exp.y (yylex): Ditto. * minsyms.c (prim_record_minimal_symbol_and_info): Ditto. * jv-exp.y (yylex): Ditto. * f-exp.y (yylex): Ditto. * event-top.c (command_line_handler): Ditto. * environ.c (get_in_environ): Ditto. (set_in_environ): Ditto. * dwarfread.c (handle_producer): Ditto. * dbxread.c (process_one_symbol): Ditto. * c-typeprint.c (c_type_print_base): Ditto. * c-exp.y (yylex): Ditto. 2003-11-06 Andrew Cagney * mi-cmd-var.c (mi_cmd_var_set_format): Replace STREQN with strncmp. --- diff --git a/gdb/ChangeLog b/gdb/ChangeLog index 9f36dd967fa..67bfb476a19 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,3 +1,19 @@ +2003-11-06 Andrew Cagney + + * valops.c (destructor_name_p): Replace STREQN with strncmp. + * top.c (command_line_input): Ditto. + * objc-exp.y (yylex): Ditto. + * minsyms.c (prim_record_minimal_symbol_and_info): Ditto. + * jv-exp.y (yylex): Ditto. + * f-exp.y (yylex): Ditto. + * event-top.c (command_line_handler): Ditto. + * environ.c (get_in_environ): Ditto. + (set_in_environ): Ditto. + * dwarfread.c (handle_producer): Ditto. + * dbxread.c (process_one_symbol): Ditto. + * c-typeprint.c (c_type_print_base): Ditto. + * c-exp.y (yylex): Ditto. + 2003-11-06 Andrew Cagney Jeff Johnston diff --git a/gdb/c-exp.y b/gdb/c-exp.y index 7630da4a17d..1f3e6838103 100644 --- a/gdb/c-exp.y +++ b/gdb/c-exp.y @@ -1340,7 +1340,7 @@ yylex () tokstart = lexptr; /* See if it is a special token of length 3. */ for (i = 0; i < sizeof tokentab3 / sizeof tokentab3[0]; i++) - if (STREQN (tokstart, tokentab3[i].operator, 3)) + if (strncmp (tokstart, tokentab3[i].operator, 3) == 0) { lexptr += 3; yylval.opcode = tokentab3[i].opcode; @@ -1349,7 +1349,7 @@ yylex () /* See if it is a special token of length 2. */ for (i = 0; i < sizeof tokentab2 / sizeof tokentab2[0]; i++) - if (STREQN (tokstart, tokentab2[i].operator, 2)) + if (strncmp (tokstart, tokentab2[i].operator, 2) == 0) { lexptr += 2; yylval.opcode = tokentab2[i].opcode; @@ -1645,52 +1645,52 @@ yylex () switch (namelen) { case 8: - if (STREQN (tokstart, "unsigned", 8)) + if (strncmp (tokstart, "unsigned", 8) == 0) return UNSIGNED; if (current_language->la_language == language_cplus - && STREQN (tokstart, "template", 8)) + && strncmp (tokstart, "template", 8) == 0) return TEMPLATE; - if (STREQN (tokstart, "volatile", 8)) + if (strncmp (tokstart, "volatile", 8) == 0) return VOLATILE_KEYWORD; break; case 6: - if (STREQN (tokstart, "struct", 6)) + if (strncmp (tokstart, "struct", 6) == 0) return STRUCT; - if (STREQN (tokstart, "signed", 6)) + if (strncmp (tokstart, "signed", 6) == 0) return SIGNED_KEYWORD; - if (STREQN (tokstart, "sizeof", 6)) + if (strncmp (tokstart, "sizeof", 6) == 0) return SIZEOF; - if (STREQN (tokstart, "double", 6)) + if (strncmp (tokstart, "double", 6) == 0) return DOUBLE_KEYWORD; break; case 5: if (current_language->la_language == language_cplus) { - if (STREQN (tokstart, "false", 5)) + if (strncmp (tokstart, "false", 5) == 0) return FALSEKEYWORD; - if (STREQN (tokstart, "class", 5)) + if (strncmp (tokstart, "class", 5) == 0) return CLASS; } - if (STREQN (tokstart, "union", 5)) + if (strncmp (tokstart, "union", 5) == 0) return UNION; - if (STREQN (tokstart, "short", 5)) + if (strncmp (tokstart, "short", 5) == 0) return SHORT; - if (STREQN (tokstart, "const", 5)) + if (strncmp (tokstart, "const", 5) == 0) return CONST_KEYWORD; break; case 4: - if (STREQN (tokstart, "enum", 4)) + if (strncmp (tokstart, "enum", 4) == 0) return ENUM; - if (STREQN (tokstart, "long", 4)) + if (strncmp (tokstart, "long", 4) == 0) return LONG; if (current_language->la_language == language_cplus) { - if (STREQN (tokstart, "true", 4)) + if (strncmp (tokstart, "true", 4) == 0) return TRUEKEYWORD; } break; case 3: - if (STREQN (tokstart, "int", 3)) + if (strncmp (tokstart, "int", 3) == 0) return INT_KEYWORD; break; default: diff --git a/gdb/c-typeprint.c b/gdb/c-typeprint.c index b134d2939db..0e014514c91 100644 --- a/gdb/c-typeprint.c +++ b/gdb/c-typeprint.c @@ -859,10 +859,11 @@ c_type_print_base (struct type *type, struct ui_file *stream, int show, QUIT; /* Don't print out virtual function table. */ /* HP ANSI C++ case */ - if (TYPE_HAS_VTABLE (type) && (STREQN (TYPE_FIELD_NAME (type, i), "__vfp", 5))) + if (TYPE_HAS_VTABLE (type) + && (strncmp (TYPE_FIELD_NAME (type, i), "__vfp", 5) == 0)) continue; /* Other compilers */ - if (STREQN (TYPE_FIELD_NAME (type, i), "_vptr", 5) + if (strncmp (TYPE_FIELD_NAME (type, i), "_vptr", 5) == 0 && is_cplus_marker ((TYPE_FIELD_NAME (type, i))[5])) continue; diff --git a/gdb/dbxread.c b/gdb/dbxread.c index ab64fcd42c8..071af219494 100644 --- a/gdb/dbxread.c +++ b/gdb/dbxread.c @@ -3169,12 +3169,12 @@ process_one_symbol (int type, int desc, CORE_ADDR valu, char *name, int l = colon_pos - name; m = lookup_minimal_symbol_by_pc (last_pc_address); - if (m && STREQN (DEPRECATED_SYMBOL_NAME (m), name, l) + if (m && strncmp (DEPRECATED_SYMBOL_NAME (m), name, l) == 0 && DEPRECATED_SYMBOL_NAME (m)[l] == '\0') /* last_pc_address was in this function */ valu = SYMBOL_VALUE (m); else if (m && DEPRECATED_SYMBOL_NAME (m + 1) - && STREQN (DEPRECATED_SYMBOL_NAME (m + 1), name, l) + && strncmp (DEPRECATED_SYMBOL_NAME (m + 1), name, l) == 0 && DEPRECATED_SYMBOL_NAME (m + 1)[l] == '\0') /* last_pc_address was in last function */ valu = SYMBOL_VALUE (m + 1); diff --git a/gdb/dwarfread.c b/gdb/dwarfread.c index 6f1c76ae96f..5c1848707ab 100644 --- a/gdb/dwarfread.c +++ b/gdb/dwarfread.c @@ -1810,7 +1810,7 @@ handle_producer (char *producer) else { processing_gcc_compilation = - STREQN (producer, GPLUS_PRODUCER, strlen (GPLUS_PRODUCER)); + strncmp (producer, GPLUS_PRODUCER, strlen (GPLUS_PRODUCER)) == 0; } /* Select a demangling style if we can identify the producer and if diff --git a/gdb/environ.c b/gdb/environ.c index 8612b0afb6c..01eb57a3658 100644 --- a/gdb/environ.c +++ b/gdb/environ.c @@ -106,7 +106,7 @@ get_in_environ (const struct environ *e, const char *var) char *s; for (; (s = *vector) != NULL; vector++) - if (STREQN (s, var, len) && s[len] == '=') + if (strncmp (s, var, len) == 0 && s[len] == '=') return &s[len + 1]; return 0; @@ -123,7 +123,7 @@ set_in_environ (struct environ *e, const char *var, const char *value) char *s; for (i = 0; (s = vector[i]) != NULL; i++) - if (STREQN (s, var, len) && s[len] == '=') + if (strncmp (s, var, len) == 0 && s[len] == '=') break; if (s == 0) diff --git a/gdb/event-top.c b/gdb/event-top.c index 28c482d93da..913e030f54e 100644 --- a/gdb/event-top.c +++ b/gdb/event-top.c @@ -702,7 +702,7 @@ command_line_handler (char *rl) #define SERVER_COMMAND_LENGTH 7 server_command = (p - linebuffer > SERVER_COMMAND_LENGTH) - && STREQN (linebuffer, "server ", SERVER_COMMAND_LENGTH); + && strncmp (linebuffer, "server ", SERVER_COMMAND_LENGTH) == 0; if (server_command) { /* Note that we don't set `line'. Between this and the check in diff --git a/gdb/f-exp.y b/gdb/f-exp.y index 1555d5edb2a..adff33b4dd3 100644 --- a/gdb/f-exp.y +++ b/gdb/f-exp.y @@ -944,8 +944,8 @@ yylex () { for (i = 0; boolean_values[i].name != NULL; i++) { - if STREQN (tokstart, boolean_values[i].name, - strlen (boolean_values[i].name)) + if (strncmp (tokstart, boolean_values[i].name, + strlen (boolean_values[i].name)) == 0) { lexptr += strlen (boolean_values[i].name); yylval.lval = boolean_values[i].value; @@ -957,7 +957,7 @@ yylex () /* See if it is a special .foo. operator */ for (i = 0; dot_ops[i].operator != NULL; i++) - if (STREQN (tokstart, dot_ops[i].operator, strlen (dot_ops[i].operator))) + if (strncmp (tokstart, dot_ops[i].operator, strlen (dot_ops[i].operator)) == 0) { lexptr += strlen (dot_ops[i].operator); yylval.opcode = dot_ops[i].opcode; @@ -1114,8 +1114,8 @@ yylex () /* Catch specific keywords. */ for (i = 0; f77_keywords[i].operator != NULL; i++) - if (STREQN(tokstart, f77_keywords[i].operator, - strlen(f77_keywords[i].operator))) + if (strncmp (tokstart, f77_keywords[i].operator, + strlen(f77_keywords[i].operator)) == 0) { /* lexptr += strlen(f77_keywords[i].operator); */ yylval.opcode = f77_keywords[i].opcode; diff --git a/gdb/jv-exp.y b/gdb/jv-exp.y index d47a65b6cc5..586c1ca4fb3 100644 --- a/gdb/jv-exp.y +++ b/gdb/jv-exp.y @@ -872,7 +872,7 @@ yylex () tokstart = lexptr; /* See if it is a special token of length 3. */ for (i = 0; i < sizeof tokentab3 / sizeof tokentab3[0]; i++) - if (STREQN (tokstart, tokentab3[i].operator, 3)) + if (strncmp (tokstart, tokentab3[i].operator, 3) == 0) { lexptr += 3; yylval.opcode = tokentab3[i].opcode; @@ -881,7 +881,7 @@ yylex () /* See if it is a special token of length 2. */ for (i = 0; i < sizeof tokentab2 / sizeof tokentab2[0]; i++) - if (STREQN (tokstart, tokentab2[i].operator, 2)) + if (strncmp (tokstart, tokentab2[i].operator, 2) == 0) { lexptr += 2; yylval.opcode = tokentab2[i].opcode; @@ -1167,9 +1167,9 @@ yylex () } break; case 3: - if (STREQN (tokstart, "int", 3)) + if (strncmp (tokstart, "int", 3) == 0) return INT; - if (STREQN (tokstart, "new", 3)) + if (strncmp (tokstart, "new", 3) == 0) return NEW; break; default: diff --git a/gdb/mi/ChangeLog b/gdb/mi/ChangeLog index cb1ca52d597..4821597f8d6 100644 --- a/gdb/mi/ChangeLog +++ b/gdb/mi/ChangeLog @@ -1,3 +1,8 @@ +2003-11-06 Andrew Cagney + + * mi-cmd-var.c (mi_cmd_var_set_format): Replace STREQN with + strncmp. + 2003-10-24 Andrew Cagney * tui-out.c: Fix "fortunatly"[sic]. diff --git a/gdb/mi/mi-cmd-var.c b/gdb/mi/mi-cmd-var.c index 0da61066809..114531cdcfa 100644 --- a/gdb/mi/mi-cmd-var.c +++ b/gdb/mi/mi-cmd-var.c @@ -189,15 +189,15 @@ mi_cmd_var_set_format (char *command, char **argv, int argc) len = strlen (formspec); - if (STREQN (formspec, "natural", len)) + if (strncmp (formspec, "natural", len) == 0) format = FORMAT_NATURAL; - else if (STREQN (formspec, "binary", len)) + else if (strncmp (formspec, "binary", len) == 0) format = FORMAT_BINARY; - else if (STREQN (formspec, "decimal", len)) + else if (strncmp (formspec, "decimal", len) == 0) format = FORMAT_DECIMAL; - else if (STREQN (formspec, "hexadecimal", len)) + else if (strncmp (formspec, "hexadecimal", len) == 0) format = FORMAT_HEXADECIMAL; - else if (STREQN (formspec, "octal", len)) + else if (strncmp (formspec, "octal", len) == 0) format = FORMAT_OCTAL; else error ("mi_cmd_var_set_format: Unknown display format: must be: \"natural\", \"binary\", \"decimal\", \"hexadecimal\", or \"octal\""); diff --git a/gdb/minsyms.c b/gdb/minsyms.c index c19455552f4..da02f794a73 100644 --- a/gdb/minsyms.c +++ b/gdb/minsyms.c @@ -586,7 +586,7 @@ prim_record_minimal_symbol_and_info (const char *name, CORE_ADDR address, const char *tempstring = name; if (tempstring[0] == get_symbol_leading_char (objfile->obfd)) ++tempstring; - if (STREQN (tempstring, "__gnu_compiled", 14)) + if (strncmp (tempstring, "__gnu_compiled", 14) == 0) return (NULL); } } diff --git a/gdb/objc-exp.y b/gdb/objc-exp.y index d47fd687d03..f6123e6ab1d 100644 --- a/gdb/objc-exp.y +++ b/gdb/objc-exp.y @@ -1592,7 +1592,7 @@ yylex () if (STREQN (tokstart, "unsigned", 8)) return UNSIGNED; if (current_language->la_language == language_cplus - && STREQN (tokstart, "template", 8)) + && strncmp (tokstart, "template", 8) == 0) return TEMPLATE; if (STREQN (tokstart, "volatile", 8)) return VOLATILE_KEYWORD; @@ -1609,7 +1609,7 @@ yylex () break; case 5: if ((current_language->la_language == language_cplus) - && STREQN (tokstart, "class", 5)) + && strncmp (tokstart, "class", 5) == 0) return CLASS; if (STREQN (tokstart, "union", 5)) return UNION; diff --git a/gdb/top.c b/gdb/top.c index baad701a7a3..50c00ea46c7 100644 --- a/gdb/top.c +++ b/gdb/top.c @@ -1266,7 +1266,7 @@ command_line_input (char *prompt_arg, int repeat, char *annotation_suffix) #define SERVER_COMMAND_LENGTH 7 server_command = (p - linebuffer > SERVER_COMMAND_LENGTH) - && STREQN (linebuffer, "server ", SERVER_COMMAND_LENGTH); + && strncmp (linebuffer, "server ", SERVER_COMMAND_LENGTH) == 0; if (server_command) { /* Note that we don't set `line'. Between this and the check in diff --git a/gdb/valops.c b/gdb/valops.c index e037441a925..0d247080591 100644 --- a/gdb/valops.c +++ b/gdb/valops.c @@ -2137,7 +2137,7 @@ destructor_name_p (const char *name, const struct type *type) len = strlen (dname); else len = cp - dname; - if (strlen (name + 1) != len || !STREQN (dname, name + 1, len)) + if (strlen (name + 1) != len || strncmp (dname, name + 1, len) != 0) error ("name of destructor must equal name of class"); else return 1;