diff options
| author | Paul Eggert | 2021-07-12 00:00:20 -0700 |
|---|---|---|
| committer | Paul Eggert | 2021-07-12 00:12:20 -0700 |
| commit | 2337869fbf8b967eb53ee57f978f3751987e43dc (patch) | |
| tree | 4efade0869b4c3f1d23ba4e09bdfc19cc2f57778 /src | |
| parent | da2f772fe575b20bff51b49aa5ded2bf15a2c89d (diff) | |
| download | emacs-2337869fbf8b967eb53ee57f978f3751987e43dc.tar.gz emacs-2337869fbf8b967eb53ee57f978f3751987e43dc.zip | |
Pacify gcc 11.1.1 -Wanalyzer-null-argument
* lib-src/etags.c (regexp): Omit member force_explicit_name,
since it’s always true. All uses removed. This lets us
remove calls to strlen (name) where GCC isn’t smart enough
to deduce that name must be nonnull.
* lib-src/movemail.c (main): Fix bug that could cause
link (tempname, NULL) to be called.
* src/emacs.c (argmatch): Break check into two ‘if’s,
since GCC doesn’t seem to be smart enough to check the single ‘if’.
* src/gtkutil.c (xg_update_menu_item): Fix bug where strcmp
could be given a NULL arg.
* src/xfont.c (xfont_list_family): Use nonnull value for dummy
initial value.
Diffstat (limited to 'src')
| -rw-r--r-- | src/emacs.c | 4 | ||||
| -rw-r--r-- | src/gtkutil.c | 2 | ||||
| -rw-r--r-- | src/xfont.c | 5 |
3 files changed, 8 insertions, 3 deletions
diff --git a/src/emacs.c b/src/emacs.c index b7982ece646..866e43fda94 100644 --- a/src/emacs.c +++ b/src/emacs.c | |||
| @@ -670,7 +670,9 @@ argmatch (char **argv, int argc, const char *sstr, const char *lstr, | |||
| 670 | } | 670 | } |
| 671 | arglen = (valptr != NULL && (p = strchr (arg, '=')) != NULL | 671 | arglen = (valptr != NULL && (p = strchr (arg, '=')) != NULL |
| 672 | ? p - arg : strlen (arg)); | 672 | ? p - arg : strlen (arg)); |
| 673 | if (lstr == 0 || arglen < minlen || strncmp (arg, lstr, arglen) != 0) | 673 | if (!lstr) |
| 674 | return 0; | ||
| 675 | if (arglen < minlen || strncmp (arg, lstr, arglen) != 0) | ||
| 674 | return 0; | 676 | return 0; |
| 675 | else if (valptr == NULL) | 677 | else if (valptr == NULL) |
| 676 | { | 678 | { |
diff --git a/src/gtkutil.c b/src/gtkutil.c index dee2a930891..313cfc82c26 100644 --- a/src/gtkutil.c +++ b/src/gtkutil.c | |||
| @@ -3221,7 +3221,7 @@ xg_update_menu_item (widget_value *val, | |||
| 3221 | gtk_label_set_text (wkey, utf8_key); | 3221 | gtk_label_set_text (wkey, utf8_key); |
| 3222 | } | 3222 | } |
| 3223 | 3223 | ||
| 3224 | if (! old_label || strcmp (utf8_label, old_label) != 0) | 3224 | if (utf8_label && (! old_label || strcmp (utf8_label, old_label) != 0)) |
| 3225 | { | 3225 | { |
| 3226 | label_changed = true; | 3226 | label_changed = true; |
| 3227 | gtk_label_set_text (wlbl, utf8_label); | 3227 | gtk_label_set_text (wlbl, utf8_label); |
diff --git a/src/xfont.c b/src/xfont.c index 0570ee96a90..81d356175a4 100644 --- a/src/xfont.c +++ b/src/xfont.c | |||
| @@ -596,7 +596,10 @@ xfont_list_family (struct frame *f) | |||
| 596 | char **names; | 596 | char **names; |
| 597 | int num_fonts, i; | 597 | int num_fonts, i; |
| 598 | Lisp_Object list; | 598 | Lisp_Object list; |
| 599 | char *last_family UNINIT; | 599 | char const *last_family; |
| 600 | #if defined GCC_LINT || defined lint | ||
| 601 | last_family = ""; | ||
| 602 | #endif | ||
| 600 | int last_len; | 603 | int last_len; |
| 601 | 604 | ||
| 602 | block_input (); | 605 | block_input (); |