diff options
| author | Paul Eggert | 2015-07-31 09:46:45 -0700 |
|---|---|---|
| committer | Paul Eggert | 2015-07-31 09:47:19 -0700 |
| commit | 8a7a99e0280103e223b8e1a717107bdf9b8eabc7 (patch) | |
| tree | bd6794e32994e43745d8764fc252f98c458b7562 /src/keyboard.c | |
| parent | f5fc5cd5c207a4fc3bdde381ad4f74c8fe6bb5d6 (diff) | |
| download | emacs-8a7a99e0280103e223b8e1a717107bdf9b8eabc7.tar.gz emacs-8a7a99e0280103e223b8e1a717107bdf9b8eabc7.zip | |
Port to pedantic memcpy
* src/keyboard.c (menu_bar_items, tool_bar_items):
* src/xrdb.c (magic_db):
Port to pedantic memcpy implementations that reject memcpy (0, 0, 0).
Diffstat (limited to 'src/keyboard.c')
| -rw-r--r-- | src/keyboard.c | 26 |
1 files changed, 14 insertions, 12 deletions
diff --git a/src/keyboard.c b/src/keyboard.c index 6bd123c6710..91cca8e477e 100644 --- a/src/keyboard.c +++ b/src/keyboard.c | |||
| @@ -7481,18 +7481,19 @@ menu_bar_items (Lisp_Object old) | |||
| 7481 | properties may not work reliable, as they are only | 7481 | properties may not work reliable, as they are only |
| 7482 | recognized when the menu-bar (or mode-line) is updated, | 7482 | recognized when the menu-bar (or mode-line) is updated, |
| 7483 | which does not normally happen after every command. */ | 7483 | which does not normally happen after every command. */ |
| 7484 | Lisp_Object tem; | 7484 | ptrdiff_t nminor = current_minor_maps (NULL, &tmaps); |
| 7485 | ptrdiff_t nminor; | ||
| 7486 | nminor = current_minor_maps (NULL, &tmaps); | ||
| 7487 | SAFE_NALLOCA (maps, 1, nminor + 4); | 7485 | SAFE_NALLOCA (maps, 1, nminor + 4); |
| 7488 | nmaps = 0; | 7486 | nmaps = 0; |
| 7489 | tem = KVAR (current_kboard, Voverriding_terminal_local_map); | 7487 | Lisp_Object tem = KVAR (current_kboard, Voverriding_terminal_local_map); |
| 7490 | if (!NILP (tem) && !NILP (Voverriding_local_map_menu_flag)) | 7488 | if (!NILP (tem) && !NILP (Voverriding_local_map_menu_flag)) |
| 7491 | maps[nmaps++] = tem; | 7489 | maps[nmaps++] = tem; |
| 7492 | if (tem = get_local_map (PT, current_buffer, Qkeymap), !NILP (tem)) | 7490 | if (tem = get_local_map (PT, current_buffer, Qkeymap), !NILP (tem)) |
| 7493 | maps[nmaps++] = tem; | 7491 | maps[nmaps++] = tem; |
| 7494 | memcpy (maps + nmaps, tmaps, nminor * sizeof (maps[0])); | 7492 | if (nminor != 0) |
| 7495 | nmaps += nminor; | 7493 | { |
| 7494 | memcpy (maps + nmaps, tmaps, nminor * sizeof (maps[0])); | ||
| 7495 | nmaps += nminor; | ||
| 7496 | } | ||
| 7496 | maps[nmaps++] = get_local_map (PT, current_buffer, Qlocal_map); | 7497 | maps[nmaps++] = get_local_map (PT, current_buffer, Qlocal_map); |
| 7497 | } | 7498 | } |
| 7498 | maps[nmaps++] = current_global_map; | 7499 | maps[nmaps++] = current_global_map; |
| @@ -8030,18 +8031,19 @@ tool_bar_items (Lisp_Object reuse, int *nitems) | |||
| 8030 | properties may not work reliable, as they are only | 8031 | properties may not work reliable, as they are only |
| 8031 | recognized when the tool-bar (or mode-line) is updated, | 8032 | recognized when the tool-bar (or mode-line) is updated, |
| 8032 | which does not normally happen after every command. */ | 8033 | which does not normally happen after every command. */ |
| 8033 | Lisp_Object tem; | 8034 | ptrdiff_t nminor = current_minor_maps (NULL, &tmaps); |
| 8034 | ptrdiff_t nminor; | ||
| 8035 | nminor = current_minor_maps (NULL, &tmaps); | ||
| 8036 | SAFE_NALLOCA (maps, 1, nminor + 4); | 8035 | SAFE_NALLOCA (maps, 1, nminor + 4); |
| 8037 | nmaps = 0; | 8036 | nmaps = 0; |
| 8038 | tem = KVAR (current_kboard, Voverriding_terminal_local_map); | 8037 | Lisp_Object tem = KVAR (current_kboard, Voverriding_terminal_local_map); |
| 8039 | if (!NILP (tem) && !NILP (Voverriding_local_map_menu_flag)) | 8038 | if (!NILP (tem) && !NILP (Voverriding_local_map_menu_flag)) |
| 8040 | maps[nmaps++] = tem; | 8039 | maps[nmaps++] = tem; |
| 8041 | if (tem = get_local_map (PT, current_buffer, Qkeymap), !NILP (tem)) | 8040 | if (tem = get_local_map (PT, current_buffer, Qkeymap), !NILP (tem)) |
| 8042 | maps[nmaps++] = tem; | 8041 | maps[nmaps++] = tem; |
| 8043 | memcpy (maps + nmaps, tmaps, nminor * sizeof (maps[0])); | 8042 | if (nminor != 0) |
| 8044 | nmaps += nminor; | 8043 | { |
| 8044 | memcpy (maps + nmaps, tmaps, nminor * sizeof (maps[0])); | ||
| 8045 | nmaps += nminor; | ||
| 8046 | } | ||
| 8045 | maps[nmaps++] = get_local_map (PT, current_buffer, Qlocal_map); | 8047 | maps[nmaps++] = get_local_map (PT, current_buffer, Qlocal_map); |
| 8046 | } | 8048 | } |
| 8047 | 8049 | ||