aboutsummaryrefslogtreecommitdiffstats
path: root/lib-src
diff options
context:
space:
mode:
authorPaul Eggert2015-09-16 14:39:29 -0700
committerPaul Eggert2015-09-16 14:39:54 -0700
commit82198ed57e3059f0526658608fd22b5fc87ab734 (patch)
tree22d52814f4cf8bdd65739852cc8adc17c1e74050 /lib-src
parent641350b2fd23e47e7f9c3cc02dda04576fa10df7 (diff)
downloademacs-82198ed57e3059f0526658608fd22b5fc87ab734.tar.gz
emacs-82198ed57e3059f0526658608fd22b5fc87ab734.zip
etags ‘fatal’ function is now printf-like
* lib-src/etags.c (fatal): Now printf-like. All callers changed. Also, now static; not clear why it needed to be extern. (verror): New function, with most of the old contents of ‘error’. (fatal, error): Use it.
Diffstat (limited to 'lib-src')
-rw-r--r--lib-src/etags.c32
1 files changed, 21 insertions, 11 deletions
diff --git a/lib-src/etags.c b/lib-src/etags.c
index f34c985109d..7baff8cbfe8 100644
--- a/lib-src/etags.c
+++ b/lib-src/etags.c
@@ -361,8 +361,9 @@ static void analyze_regex (char *);
361static void free_regexps (void); 361static void free_regexps (void);
362static void regex_tag_multiline (void); 362static void regex_tag_multiline (void);
363static void error (const char *, ...) ATTRIBUTE_FORMAT_PRINTF (1, 2); 363static void error (const char *, ...) ATTRIBUTE_FORMAT_PRINTF (1, 2);
364static void verror (char const *, va_list) ATTRIBUTE_FORMAT_PRINTF (1, 0);
364static _Noreturn void suggest_asking_for_help (void); 365static _Noreturn void suggest_asking_for_help (void);
365_Noreturn void fatal (const char *, const char *); 366static _Noreturn void fatal (char const *, ...) ATTRIBUTE_FORMAT_PRINTF (1, 2);
366static _Noreturn void pfatal (const char *); 367static _Noreturn void pfatal (const char *);
367static void add_node (node *, node **); 368static void add_node (node *, node **);
368 369
@@ -1091,7 +1092,7 @@ main (int argc, char **argv)
1091 ++current_arg; 1092 ++current_arg;
1092 ++file_count; 1093 ++file_count;
1093 if (parsing_stdin) 1094 if (parsing_stdin)
1094 fatal ("cannot parse standard input more than once", (char *)NULL); 1095 fatal ("cannot parse standard input more than once");
1095 parsing_stdin = true; 1096 parsing_stdin = true;
1096 break; 1097 break;
1097 1098
@@ -1255,8 +1256,8 @@ main (int argc, char **argv)
1255 if (streq (this_file, "-")) 1256 if (streq (this_file, "-"))
1256 { 1257 {
1257 if (parsing_stdin) 1258 if (parsing_stdin)
1258 fatal ("cannot parse standard input AND read file names from it", 1259 fatal ("cannot parse standard input "
1259 (char *)NULL); 1260 "AND read file names from it");
1260 while (readline_internal (&filename_lb, stdin, "-") > 0) 1261 while (readline_internal (&filename_lb, stdin, "-") > 0)
1261 process_file_name (filename_lb.buffer, lang); 1262 process_file_name (filename_lb.buffer, lang);
1262 } 1263 }
@@ -1324,7 +1325,7 @@ main (int argc, char **argv)
1324 z = stpcpy (z, tagfile); 1325 z = stpcpy (z, tagfile);
1325 strcpy (z, ";rm OTAGS"); 1326 strcpy (z, ";rm OTAGS");
1326 if (system (cmd) != EXIT_SUCCESS) 1327 if (system (cmd) != EXIT_SUCCESS)
1327 fatal ("failed to execute shell command", (char *)NULL); 1328 fatal ("failed to execute shell command");
1328 } 1329 }
1329 free (cmd); 1330 free (cmd);
1330 append_to_tagfile = true; 1331 append_to_tagfile = true;
@@ -6351,10 +6352,13 @@ skip_name (char *cp)
6351} 6352}
6352 6353
6353/* Print error message and exit. */ 6354/* Print error message and exit. */
6354void 6355static void
6355fatal (const char *s1, const char *s2) 6356fatal (char const *format, ...)
6356{ 6357{
6357 error (s1, s2); 6358 va_list ap;
6359 va_start (ap, format);
6360 verror (format, ap);
6361 va_end (ap);
6358 exit (EXIT_FAILURE); 6362 exit (EXIT_FAILURE);
6359} 6363}
6360 6364
@@ -6379,10 +6383,16 @@ error (const char *format, ...)
6379{ 6383{
6380 va_list ap; 6384 va_list ap;
6381 va_start (ap, format); 6385 va_start (ap, format);
6386 verror (format, ap);
6387 va_end (ap);
6388}
6389
6390static void
6391verror (char const *format, va_list ap)
6392{
6382 fprintf (stderr, "%s: ", progname); 6393 fprintf (stderr, "%s: ", progname);
6383 vfprintf (stderr, format, ap); 6394 vfprintf (stderr, format, ap);
6384 fprintf (stderr, "\n"); 6395 fprintf (stderr, "\n");
6385 va_end (ap);
6386} 6396}
6387 6397
6388/* Return a newly-allocated string whose contents 6398/* Return a newly-allocated string whose contents
@@ -6673,7 +6683,7 @@ xmalloc (size_t size)
6673{ 6683{
6674 void *result = malloc (size); 6684 void *result = malloc (size);
6675 if (result == NULL) 6685 if (result == NULL)
6676 fatal ("virtual memory exhausted", (char *)NULL); 6686 fatal ("virtual memory exhausted");
6677 return result; 6687 return result;
6678} 6688}
6679 6689
@@ -6682,7 +6692,7 @@ xrealloc (void *ptr, size_t size)
6682{ 6692{
6683 void *result = realloc (ptr, size); 6693 void *result = realloc (ptr, size);
6684 if (result == NULL) 6694 if (result == NULL)
6685 fatal ("virtual memory exhausted", (char *)NULL); 6695 fatal ("virtual memory exhausted");
6686 return result; 6696 return result;
6687} 6697}
6688 6698