diff options
| author | Paul Eggert | 2011-06-19 11:37:51 -0700 |
|---|---|---|
| committer | Paul Eggert | 2011-06-19 11:37:51 -0700 |
| commit | 0b963a931c2ba66829dbdb8489fe83e100d2326c (patch) | |
| tree | 49cba90bbfb22eff2afb2f97a4341b0f36df2099 /src | |
| parent | 573f4b54074f81bff59d5da768da2d044d358fe1 (diff) | |
| download | emacs-0b963a931c2ba66829dbdb8489fe83e100d2326c.tar.gz emacs-0b963a931c2ba66829dbdb8489fe83e100d2326c.zip | |
* emacs.c: Don't assume string length fits in 'int'.
(DEFINE_DUMMY_FUNCTION, sort_args): Use ptrdiff_t, not int.
(main): Don't invoke strlen when not needed.
Diffstat (limited to 'src')
| -rw-r--r-- | src/ChangeLog | 4 | ||||
| -rw-r--r-- | src/emacs.c | 15 |
2 files changed, 11 insertions, 8 deletions
diff --git a/src/ChangeLog b/src/ChangeLog index 3a7cad71c35..cc10da99d83 100644 --- a/src/ChangeLog +++ b/src/ChangeLog | |||
| @@ -1,5 +1,9 @@ | |||
| 1 | 2011-06-19 Paul Eggert <eggert@cs.ucla.edu> | 1 | 2011-06-19 Paul Eggert <eggert@cs.ucla.edu> |
| 2 | 2 | ||
| 3 | * emacs.c: Don't assume string length fits in 'int'. | ||
| 4 | (DEFINE_DUMMY_FUNCTION, sort_args): Use ptrdiff_t, not int. | ||
| 5 | (main): Don't invoke strlen when not needed. | ||
| 6 | |||
| 3 | * dbusbind.c (XD_ERROR): Don't arbitrarily truncate string. | 7 | * dbusbind.c (XD_ERROR): Don't arbitrarily truncate string. |
| 4 | (XD_DEBUG_MESSAGE): Don't waste a byte. | 8 | (XD_DEBUG_MESSAGE): Don't waste a byte. |
| 5 | 9 | ||
diff --git a/src/emacs.c b/src/emacs.c index d14acd63587..c4b4caad9b5 100644 --- a/src/emacs.c +++ b/src/emacs.c | |||
| @@ -585,7 +585,7 @@ argmatch (char **argv, int argc, const char *sstr, const char *lstr, | |||
| 585 | int minlen, char **valptr, int *skipptr) | 585 | int minlen, char **valptr, int *skipptr) |
| 586 | { | 586 | { |
| 587 | char *p = NULL; | 587 | char *p = NULL; |
| 588 | int arglen; | 588 | ptrdiff_t arglen; |
| 589 | char *arg; | 589 | char *arg; |
| 590 | 590 | ||
| 591 | /* Don't access argv[argc]; give up in advance. */ | 591 | /* Don't access argv[argc]; give up in advance. */ |
| @@ -1087,7 +1087,7 @@ Using an Emacs configured with --with-x-toolkit=lucid does not have this problem | |||
| 1087 | dname_arg2[0] = '\0'; | 1087 | dname_arg2[0] = '\0'; |
| 1088 | sscanf (dname_arg, "\n%d,%d\n%s", &(daemon_pipe[0]), &(daemon_pipe[1]), | 1088 | sscanf (dname_arg, "\n%d,%d\n%s", &(daemon_pipe[0]), &(daemon_pipe[1]), |
| 1089 | dname_arg2); | 1089 | dname_arg2); |
| 1090 | dname_arg = strlen (dname_arg2) ? dname_arg2 : NULL; | 1090 | dname_arg = *dname_arg2 ? dname_arg2 : NULL; |
| 1091 | } | 1091 | } |
| 1092 | #endif /* NS_IMPL_COCOA */ | 1092 | #endif /* NS_IMPL_COCOA */ |
| 1093 | 1093 | ||
| @@ -1846,8 +1846,7 @@ sort_args (int argc, char **argv) | |||
| 1846 | priority[from] = 0; | 1846 | priority[from] = 0; |
| 1847 | if (argv[from][0] == '-') | 1847 | if (argv[from][0] == '-') |
| 1848 | { | 1848 | { |
| 1849 | int match, thislen; | 1849 | int match; |
| 1850 | char *equals; | ||
| 1851 | 1850 | ||
| 1852 | /* If we have found "--", don't consider | 1851 | /* If we have found "--", don't consider |
| 1853 | any more arguments as options. */ | 1852 | any more arguments as options. */ |
| @@ -1879,11 +1878,11 @@ sort_args (int argc, char **argv) | |||
| 1879 | >= 0 (the table index of the match) if just one match so far. */ | 1878 | >= 0 (the table index of the match) if just one match so far. */ |
| 1880 | if (argv[from][1] == '-') | 1879 | if (argv[from][1] == '-') |
| 1881 | { | 1880 | { |
| 1881 | char const *equals = strchr (argv[from], '='); | ||
| 1882 | ptrdiff_t thislen = | ||
| 1883 | equals ? equals - argv[from] : strlen (argv[from]); | ||
| 1884 | |||
| 1882 | match = -1; | 1885 | match = -1; |
| 1883 | thislen = strlen (argv[from]); | ||
| 1884 | equals = strchr (argv[from], '='); | ||
| 1885 | if (equals != 0) | ||
| 1886 | thislen = equals - argv[from]; | ||
| 1887 | 1886 | ||
| 1888 | for (i = 0; | 1887 | for (i = 0; |
| 1889 | i < sizeof (standard_args) / sizeof (standard_args[0]); i++) | 1888 | i < sizeof (standard_args) / sizeof (standard_args[0]); i++) |