diff options
| author | Paul Eggert | 2019-06-25 14:53:39 -0700 |
|---|---|---|
| committer | Paul Eggert | 2019-06-25 14:55:08 -0700 |
| commit | d7c6836288c91bb639956cb8c748dd6597c55cd4 (patch) | |
| tree | 687f6f257d3cb5f4bd54eb634aef2737eb9c0856 /lib-src/update-game-score.c | |
| parent | 349b778dde7f583a92dd1531aef3ff5c336e9aee (diff) | |
| download | emacs-d7c6836288c91bb639956cb8c748dd6597c55cd4.tar.gz emacs-d7c6836288c91bb639956cb8c748dd6597c55cd4.zip | |
Avoid some strlen work, primarily via strnlen
* admin/merge-gnulib (GNULIB_MODULES): Add strnlen.
* lib-src/etags.c (find_entries):
* src/emacs.c (main):
* src/nsmenu.m (parseKeyEquiv:):
* src/nsterm.m (ns_xlfd_to_fontname):
* src/term.c (vfatal):
Prefer !*X to !strlen (X).
* lib-src/etags.c (pfnote, add_regex):
* lib-src/pop.c (pop_open):
* lib-src/update-game-score.c (main):
* lwlib/lwlib.c (lw_separator_p):
* src/doprnt.c (doprnt):
* src/emacs.c (main):
* src/inotify.c (inotifyevent_to_event):
* src/keyboard.c (menu_separator_name_p, parse_tool_bar_item):
* src/sysdep.c (get_current_dir_name_or_unreachable):
* src/xdisp.c (store_mode_line_string):
Use strnlen to avoid unnecessary work with strlen.
* lib-src/etags.c (Prolog_functions, prolog_pr)
(Erlang_functions, erlang_func):
Prefer ptrdiff_t to size_t when either will do.
(prolog_pr, erlang_func): New arg LASTLEN, to avoid
unnecessary strlen call. All callers changed.
* lib/gnulib.mk.in, m4/gnulib-comp.m4: Regenerate.
* lib/strnlen.c, m4/strnlen.m4: New files, copied from Gnulib.
* lwlib/lwlib.c (lw_separator_p):
* src/json.c (json_has_prefix):
Use strncmp to avoid unecessary work with strlen + memcmp.
* src/process.c (set_socket_option): Use SBYTES instead of strlen.
Diffstat (limited to 'lib-src/update-game-score.c')
| -rw-r--r-- | lib-src/update-game-score.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/lib-src/update-game-score.c b/lib-src/update-game-score.c index 8a6f46b38e7..782425186e8 100644 --- a/lib-src/update-game-score.c +++ b/lib-src/update-game-score.c | |||
| @@ -240,7 +240,7 @@ main (int argc, char **argv) | |||
| 240 | if (! user) | 240 | if (! user) |
| 241 | lose_syserr ("Couldn't determine user id"); | 241 | lose_syserr ("Couldn't determine user id"); |
| 242 | data = argv[optind + 2]; | 242 | data = argv[optind + 2]; |
| 243 | if (strlen (data) > MAX_DATA_LEN) | 243 | if (strnlen (data, MAX_DATA_LEN + 1) == MAX_DATA_LEN + 1) |
| 244 | data[MAX_DATA_LEN] = '\0'; | 244 | data[MAX_DATA_LEN] = '\0'; |
| 245 | nl = strchr (data, '\n'); | 245 | nl = strchr (data, '\n'); |
| 246 | if (nl) | 246 | if (nl) |