aboutsummaryrefslogtreecommitdiffstats
path: root/lib-src/emacsclient.c
diff options
context:
space:
mode:
authorPaul Eggert2018-04-28 16:49:24 -0700
committerPaul Eggert2018-04-28 16:56:48 -0700
commit8c3215e7a47e3caaa005bf573765ed63e0739b89 (patch)
tree0b90cacdef1a62ff888e92d0742b715ee69705ce /lib-src/emacsclient.c
parent2b9ab8c8fba849da8bf2aa45e65b122bb937a6b3 (diff)
downloademacs-8c3215e7a47e3caaa005bf573765ed63e0739b89.tar.gz
emacs-8c3215e7a47e3caaa005bf573765ed63e0739b89.zip
Port --enable-gcc-warnings to GCC 8
* configure.ac: Do not use GCC 8’s new -Wcast-align flag. * lib-src/ebrowse.c (xmalloc): * lib-src/emacsclient.c (xmalloc, xstrdup): * lib-src/etags.c (xmalloc): * lib-src/make-docfile.c (xmalloc): * lib-src/movemail.c (xmalloc): * src/dispnew.c (new_glyph_pool): * src/regex.c (xmalloc): * src/term.c (tty_menu_create): * src/tparam.h (tparam): Use ATTRIBUTE_MALLOC. Also see GCC bug 85562. * lib-src/emacsclient.c (fail): Do not dereference a null pointer. * src/frame.c (delete_frame): Add a decl with UNINIT to work around GCC bug 85563. * src/menu.h (finish_menu_items): Do not use attribute const. * src/regex.c (analyze_first): Use FALLTHROUGH, not a comment.
Diffstat (limited to 'lib-src/emacsclient.c')
-rw-r--r--lib-src/emacsclient.c25
1 files changed, 14 insertions, 11 deletions
diff --git a/lib-src/emacsclient.c b/lib-src/emacsclient.c
index 574bec850fa..739e6d5949e 100644
--- a/lib-src/emacsclient.c
+++ b/lib-src/emacsclient.c
@@ -192,7 +192,7 @@ struct option longopts[] =
192 192
193/* Like malloc but get fatal error if memory is exhausted. */ 193/* Like malloc but get fatal error if memory is exhausted. */
194 194
195static void * 195static void * ATTRIBUTE_MALLOC
196xmalloc (size_t size) 196xmalloc (size_t size)
197{ 197{
198 void *result = malloc (size); 198 void *result = malloc (size);
@@ -219,7 +219,7 @@ xrealloc (void *ptr, size_t size)
219} 219}
220 220
221/* Like strdup but get a fatal error if memory is exhausted. */ 221/* Like strdup but get a fatal error if memory is exhausted. */
222char *xstrdup (const char *); 222char *xstrdup (const char *) ATTRIBUTE_MALLOC;
223 223
224char * 224char *
225xstrdup (const char *s) 225xstrdup (const char *s)
@@ -261,7 +261,7 @@ get_current_dir_name (void)
261#endif 261#endif
262 ) 262 )
263 { 263 {
264 buf = (char *) xmalloc (strlen (pwd) + 1); 264 buf = xmalloc (strlen (pwd) + 1);
265 strcpy (buf, pwd); 265 strcpy (buf, pwd);
266 } 266 }
267 else 267 else
@@ -312,12 +312,15 @@ w32_get_resource (HKEY predefined, const char *key, LPDWORD type)
312 312
313 if (RegOpenKeyEx (predefined, REG_ROOT, 0, KEY_READ, &hrootkey) == ERROR_SUCCESS) 313 if (RegOpenKeyEx (predefined, REG_ROOT, 0, KEY_READ, &hrootkey) == ERROR_SUCCESS)
314 { 314 {
315 if (RegQueryValueEx (hrootkey, key, NULL, NULL, NULL, &cbData) == ERROR_SUCCESS) 315 if (RegQueryValueEx (hrootkey, key, NULL, NULL, NULL, &cbData)
316 == ERROR_SUCCESS)
316 { 317 {
317 result = (char *) xmalloc (cbData); 318 result = xmalloc (cbData);
318 319
319 if ((RegQueryValueEx (hrootkey, key, NULL, type, (LPBYTE)result, &cbData) != ERROR_SUCCESS) 320 if ((RegQueryValueEx (hrootkey, key, NULL, type, (LPBYTE) result,
320 || (*result == 0)) 321 &cbData)
322 != ERROR_SUCCESS)
323 || *result == 0)
321 { 324 {
322 free (result); 325 free (result);
323 result = NULL; 326 result = NULL;
@@ -369,7 +372,7 @@ w32_getenv (const char *envvar)
369 372
370 if ((size = ExpandEnvironmentStrings (value, NULL, 0))) 373 if ((size = ExpandEnvironmentStrings (value, NULL, 0)))
371 { 374 {
372 char *buffer = (char *) xmalloc (size); 375 char *buffer = xmalloc (size);
373 if (ExpandEnvironmentStrings (value, buffer, size)) 376 if (ExpandEnvironmentStrings (value, buffer, size))
374 { 377 {
375 /* Found and expanded. */ 378 /* Found and expanded. */
@@ -700,7 +703,7 @@ fail (void)
700 { 703 {
701 size_t extra_args_size = (main_argc - optind + 1) * sizeof (char *); 704 size_t extra_args_size = (main_argc - optind + 1) * sizeof (char *);
702 size_t new_argv_size = extra_args_size; 705 size_t new_argv_size = extra_args_size;
703 char **new_argv = NULL; 706 char **new_argv = xmalloc (new_argv_size);
704 char *s = xstrdup (alternate_editor); 707 char *s = xstrdup (alternate_editor);
705 unsigned toks = 0; 708 unsigned toks = 0;
706 709
@@ -833,7 +836,7 @@ send_to_emacs (HSOCKET s, const char *data)
833static void 836static void
834quote_argument (HSOCKET s, const char *str) 837quote_argument (HSOCKET s, const char *str)
835{ 838{
836 char *copy = (char *) xmalloc (strlen (str) * 2 + 1); 839 char *copy = xmalloc (strlen (str) * 2 + 1);
837 const char *p; 840 const char *p;
838 char *q; 841 char *q;
839 842
@@ -1843,7 +1846,7 @@ main (int argc, char **argv)
1843 careful to expand <relpath> with the default directory 1846 careful to expand <relpath> with the default directory
1844 corresponding to <drive>. */ 1847 corresponding to <drive>. */
1845 { 1848 {
1846 char *filename = (char *) xmalloc (MAX_PATH); 1849 char *filename = xmalloc (MAX_PATH);
1847 DWORD size; 1850 DWORD size;
1848 1851
1849 size = GetFullPathName (argv[i], MAX_PATH, filename, NULL); 1852 size = GetFullPathName (argv[i], MAX_PATH, filename, NULL);