X-Git-Url: http://git.hcoop.net/bpt/emacs.git/blobdiff_plain/9aecacd08a93bffb529cee59d74477890ce96f37..a8101f663e6cbff953b67b8bef33bc0171818477:/lib-src/ebrowse.c diff --git a/lib-src/ebrowse.c b/lib-src/ebrowse.c index ea230a9c3c..1fcbb8662f 100644 --- a/lib-src/ebrowse.c +++ b/lib-src/ebrowse.c @@ -1,39 +1,33 @@ /* ebrowse.c --- parsing files for the ebrowse C++ browser - Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, - 2002, 2003, 2004, 2005, 2006, 2007 Free Software Foundation, Inc. +Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, + 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010 + Free Software Foundation, Inc. - This file is part of GNU Emacs. +This file is part of GNU Emacs. - GNU Emacs is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 3, or (at your option) - any later version. +GNU Emacs is free software: you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation, either version 3 of the License, or +(at your option) any later version. - GNU Emacs is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. +GNU Emacs is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. - You should have received a copy of the GNU General Public License - along with GNU Emacs; see the file COPYING. If not, write to the - Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, - Boston, MA 02110-1301, USA. */ +You should have received a copy of the GNU General Public License +along with GNU Emacs. If not, see . */ -#ifdef HAVE_CONFIG_H -#include -#endif +#include #include #ifdef HAVE_STDLIB_H #include #endif -#ifdef HAVE_STRING_H #include -#endif - #include #include #include "getopt.h" @@ -45,12 +39,6 @@ /* Conditionalize function prototypes. */ -#ifdef PROTOTYPES /* From config.h. */ -#define P_(x) x -#else -#define P_(x) () -#endif - /* Value is non-zero if strings X and Y compare equal. */ #define streq(X, Y) (*(X) == *(Y) && strcmp ((X) + 1, (Y) + 1) == 0) @@ -261,10 +249,10 @@ struct member int vis; /* Visibility (public, ...). */ int flags; /* See F_* above. */ char *regexp; /* Matching regular expression. */ - char *filename; /* Don't free this shared string. */ + const char *filename; /* Don't free this shared string. */ int pos; /* Buffer position of occurrence. */ char *def_regexp; /* Regular expression matching definition. */ - char *def_filename; /* File name of definition. */ + const char *def_filename; /* File name of definition. */ int def_pos; /* Buffer position of definition. */ char name[1]; /* Member name. */ }; @@ -306,8 +294,8 @@ struct sym struct member *types; /* List of local types. */ char *regexp; /* Matching regular expression. */ int pos; /* Buffer position. */ - char *filename; /* File in which it can be found. */ - char *sfilename; /* File in which members can be found. */ + const char *filename; /* File in which it can be found. */ + const char *sfilename; /* File in which members can be found. */ struct sym *namesp; /* Namespace in which defined. . */ char name[1]; /* Name of the class. */ }; @@ -365,7 +353,7 @@ int yyline; /* The name of the current input file. */ -char *filename; +const char *filename; /* Three character class vectors, and macros to test membership of characters. */ @@ -456,7 +444,7 @@ int tk = -1; struct kw { - char *name; /* Spelling. */ + const char *name; /* Spelling. */ int tk; /* Token value. */ struct kw *next; /* Next in collision chain. */ }; @@ -479,62 +467,59 @@ struct search_path *search_path_tail; /* Function prototypes. */ -int yylex P_ ((void)); -void yyparse P_ ((void)); -void re_init_parser P_ ((void)); -char *token_string P_ ((int)); -char *matching_regexp P_ ((void)); -void init_sym P_ ((void)); -struct sym *add_sym P_ ((char *, struct sym *)); -void add_link P_ ((struct sym *, struct sym *)); -void add_member_defn P_ ((struct sym *, char *, char *, - int, unsigned, int, int, int)); -void add_member_decl P_ ((struct sym *, char *, char *, int, - unsigned, int, int, int, int)); -void dump_roots P_ ((FILE *)); -void *xmalloc P_ ((int)); -void xfree P_ ((void *)); -void add_global_defn P_ ((char *, char *, int, unsigned, int, int, int)); -void add_global_decl P_ ((char *, char *, int, unsigned, int, int, int)); -void add_define P_ ((char *, char *, int)); -void mark_inherited_virtual P_ ((void)); -void leave_namespace P_ ((void)); -void enter_namespace P_ ((char *)); -void register_namespace_alias P_ ((char *, struct link *)); -void insert_keyword P_ ((char *, int)); -void re_init_scanner P_ ((void)); -void init_scanner P_ ((void)); -void usage P_ ((int)); -void version P_ ((void)); -void process_file P_ ((char *)); -void add_search_path P_ ((char *)); -FILE *open_file P_ ((char *)); -int process_pp_line P_ ((void)); -int dump_members P_ ((FILE *, struct member *)); -void dump_sym P_ ((FILE *, struct sym *)); -int dump_tree P_ ((FILE *, struct sym *)); -struct member *find_member P_ ((struct sym *, char *, int, int, unsigned)); -struct member *add_member P_ ((struct sym *, char *, int, int, unsigned)); -void mark_virtual P_ ((struct sym *)); -void mark_virtual P_ ((struct sym *)); -struct sym *make_namespace P_ ((char *, struct sym *)); -char *sym_scope P_ ((struct sym *)); -char *sym_scope_1 P_ ((struct sym *)); -int skip_to P_ ((int)); -void skip_matching P_ ((void)); -void member P_ ((struct sym *, int)); -void class_body P_ ((struct sym *, int)); -void class_definition P_ ((struct sym *, int, int, int)); -void declaration P_ ((int)); -unsigned parm_list P_ ((int *)); -char *operator_name P_ ((int *)); -struct sym *parse_classname P_ ((void)); -struct sym *parse_qualified_ident_or_type P_ ((char **)); -void parse_qualified_param_ident_or_type P_ ((char **)); -int globals P_ ((int)); -void yyerror P_ ((char *, char *)); -void usage P_ ((int)) NO_RETURN; -void version P_ (()) NO_RETURN; +int yylex (void); +void yyparse (void); +void re_init_parser (void); +const char *token_string (int); +char *matching_regexp (void); +void init_sym (void); +struct sym *add_sym (const char *, struct sym *); +void add_link (struct sym *, struct sym *); +void add_member_defn (struct sym *, char *, char *, + int, unsigned, int, int, int); +void add_member_decl (struct sym *, char *, char *, int, + unsigned, int, int, int, int); +void dump_roots (FILE *); +void *xmalloc (int); +void xfree (void *); +void add_global_defn (char *, char *, int, unsigned, int, int, int); +void add_global_decl (char *, char *, int, unsigned, int, int, int); +void add_define (char *, char *, int); +void mark_inherited_virtual (void); +void leave_namespace (void); +void enter_namespace (char *); +void register_namespace_alias (char *, struct link *); +void insert_keyword (const char *, int); +void re_init_scanner (void); +void init_scanner (void); +void process_file (char *); +void add_search_path (char *); +FILE *open_file (char *); +int process_pp_line (void); +int dump_members (FILE *, struct member *); +void dump_sym (FILE *, struct sym *); +int dump_tree (FILE *, struct sym *); +struct member *find_member (struct sym *, char *, int, int, unsigned); +struct member *add_member (struct sym *, char *, int, int, unsigned); +void mark_virtual (struct sym *); +struct sym *make_namespace (char *, struct sym *); +char *sym_scope (struct sym *); +char *sym_scope_1 (struct sym *); +int skip_to (int); +void skip_matching (void); +void member (struct sym *, int); +void class_body (struct sym *, int); +void class_definition (struct sym *, int, int, int); +void declaration (int); +unsigned parm_list (int *); +char *operator_name (int *); +struct sym *parse_classname (void); +struct sym *parse_qualified_ident_or_type (char **); +void parse_qualified_param_ident_or_type (char **); +int globals (int); +void yyerror (const char *, const char *); +void usage (int) NO_RETURN; +void version (void) NO_RETURN; @@ -546,8 +531,7 @@ void version P_ (()) NO_RETURN; name and line number. */ void -yyerror (format, s) - char *format, *s; +yyerror (const char *format, const char *s) { fprintf (stderr, "%s:%d: ", filename, yyline); fprintf (stderr, format, s); @@ -559,8 +543,7 @@ yyerror (format, s) available. */ void * -xmalloc (nbytes) - int nbytes; +xmalloc (int nbytes) { void *p = malloc (nbytes); if (p == NULL) @@ -575,9 +558,7 @@ xmalloc (nbytes) /* Like realloc but print an error and exit if out of memory. */ void * -xrealloc (p, sz) - void *p; - int sz; +xrealloc (void *p, int sz) { p = realloc (p, sz); if (p == NULL) @@ -589,23 +570,11 @@ xrealloc (p, sz) } -/* Like free but always check for null pointers.. */ - -void -xfree (p) - void *p; -{ - if (p) - free (p); -} - - /* Like strdup, but print an error and exit if not enough memory is available.. If S is null, return null. */ char * -xstrdup (s) - char *s; +xstrdup (char *s) { if (s) s = strcpy (xmalloc (strlen (s) + 1), s); @@ -622,7 +591,7 @@ xstrdup (s) special symbol for globals (`*Globals*'). */ void -init_sym () +init_sym (void) { global_symbols = add_sym (GLOBALS_NAME, NULL); } @@ -636,13 +605,11 @@ init_sym () create a new symbol and set it to default values. */ struct sym * -add_sym (name, nested_in_class) - char *name; - struct sym *nested_in_class; +add_sym (const char *name, struct sym *nested_in_class) { struct sym *sym; unsigned h; - char *s; + const char *s; struct sym *scope = nested_in_class ? nested_in_class : current_namespace; for (s = name, h = 0; *s; ++s) @@ -665,7 +632,7 @@ add_sym (name, nested_in_class) } sym = (struct sym *) xmalloc (sizeof *sym + strlen (name)); - bzero (sym, sizeof *sym); + memset (sym, 0, sizeof *sym); strcpy (sym->name, name); sym->namesp = scope; sym->next = class_table[h]; @@ -679,8 +646,7 @@ add_sym (name, nested_in_class) /* Add links between superclass SUPER and subclass SUB. */ void -add_link (super, sub) - struct sym *super, *sub; +add_link (struct sym *super, struct sym *sub) { struct link *lnk, *lnk2, *p, *prev; @@ -720,11 +686,7 @@ add_link (super, sub) found or null if not found. */ struct member * -find_member (cls, name, var, sc, hash) - struct sym *cls; - char *name; - int var, sc; - unsigned hash; +find_member (struct sym *cls, char *name, int var, int sc, unsigned int hash) { struct member **list; struct member *p; @@ -774,16 +736,7 @@ find_member (cls, name, var, sc, hash) F_* defines). */ void -add_member_decl (cls, name, regexp, pos, hash, var, sc, vis, flags) - struct sym *cls; - char *name; - char *regexp; - int pos; - unsigned hash; - int var; - int sc; - int vis; - int flags; +add_member_decl (struct sym *cls, char *name, char *regexp, int pos, unsigned int hash, int var, int sc, int vis, int flags) { struct member *m; @@ -831,15 +784,7 @@ add_member_decl (cls, name, regexp, pos, hash, var, sc, vis, flags) F_* defines). */ void -add_member_defn (cls, name, regexp, pos, hash, var, sc, flags) - struct sym *cls; - char *name; - char *regexp; - int pos; - unsigned hash; - int var; - int sc; - int flags; +add_member_defn (struct sym *cls, char *name, char *regexp, int pos, unsigned int hash, int var, int sc, int flags) { struct member *m; @@ -881,9 +826,7 @@ add_member_defn (cls, name, regexp, pos, hash, var, sc, flags) if it is non-null. POS is the position in the file. */ void -add_define (name, regexp, pos) - char *name, *regexp; - int pos; +add_define (char *name, char *regexp, int pos) { add_global_defn (name, regexp, pos, 0, 1, SC_FRIEND, F_DEFINE); add_global_decl (name, regexp, pos, 0, 1, SC_FRIEND, F_DEFINE); @@ -901,13 +844,7 @@ add_define (name, regexp, pos) F_* defines). */ void -add_global_defn (name, regexp, pos, hash, var, sc, flags) - char *name, *regexp; - int pos; - unsigned hash; - int var; - int sc; - int flags; +add_global_defn (char *name, char *regexp, int pos, unsigned int hash, int var, int sc, int flags) { int i; struct sym *sym; @@ -938,13 +875,7 @@ add_global_defn (name, regexp, pos, hash, var, sc, flags) F_* defines). */ void -add_global_decl (name, regexp, pos, hash, var, sc, flags) - char *name, *regexp; - int pos; - unsigned hash; - int var; - int sc; - int flags; +add_global_decl (char *name, char *regexp, int pos, unsigned int hash, int var, int sc, int flags) { /* Add declaration only if not already declared. Header files must be processed before source files for this to have the right effect. @@ -983,12 +914,7 @@ add_global_decl (name, regexp, pos, hash, var, sc, flags) Value is a pointer to the member's structure. */ struct member * -add_member (cls, name, var, sc, hash) - struct sym *cls; - char *name; - int var; - int sc; - unsigned hash; +add_member (struct sym *cls, char *name, int var, int sc, unsigned int hash) { struct member *m = (struct member *) xmalloc (sizeof *m + strlen (name)); struct member **list; @@ -1059,8 +985,7 @@ add_member (cls, name, var, sc, hash) in base classes. */ void -mark_virtual (r) - struct sym *r; +mark_virtual (struct sym *r) { struct link *p; struct member *m, *m2; @@ -1084,7 +1009,7 @@ mark_virtual (r) are virtual because of a virtual declaration in a base class. */ void -mark_inherited_virtual () +mark_inherited_virtual (void) { struct sym *r; int i; @@ -1099,12 +1024,10 @@ mark_inherited_virtual () /* Create and return a symbol for a namespace with name NAME. */ struct sym * -make_namespace (name, context) - char *name; - struct sym *context; +make_namespace (char *name, struct sym *context) { struct sym *s = (struct sym *) xmalloc (sizeof *s + strlen (name)); - bzero (s, sizeof *s); + memset (s, 0, sizeof *s); strcpy (s->name, name); s->next = all_namespaces; s->namesp = context; @@ -1116,9 +1039,7 @@ make_namespace (name, context) /* Find the symbol for namespace NAME. If not found, retrun NULL */ struct sym * -check_namespace (name, context) - char *name; - struct sym *context; +check_namespace (char *name, struct sym *context) { struct sym *p = NULL; @@ -1126,18 +1047,16 @@ check_namespace (name, context) { if (streq (p->name, name) && (p->namesp == context)) break; - } + } return p; - } +} /* Find the symbol for namespace NAME. If not found, add a new symbol for NAME to all_namespaces. */ struct sym * -find_namespace (name, context) - char *name; - struct sym *context; +find_namespace (char *name, struct sym *context) { struct sym *p = check_namespace (name, context); @@ -1151,8 +1070,7 @@ find_namespace (name, context) /* Find namespace alias with name NAME. If not found return NULL. */ struct link * -check_namespace_alias (name) - char *name; +check_namespace_alias (char *name) { struct link *p = NULL; struct alias *al; @@ -1176,9 +1094,7 @@ check_namespace_alias (name) /* Register the name NEW_NAME as an alias for namespace list OLD_NAME. */ void -register_namespace_alias (new_name, old_name) - char *new_name; - struct link *old_name; +register_namespace_alias (char *new_name, struct link *old_name) { unsigned h; char *s; @@ -1206,8 +1122,7 @@ register_namespace_alias (new_name, old_name) /* Enter namespace with name NAME. */ void -enter_namespace (name) - char *name; +enter_namespace (char *name) { struct sym *p = find_namespace (name, current_namespace); @@ -1228,7 +1143,7 @@ enter_namespace (name) /* Leave the current namespace. */ void -leave_namespace () +leave_namespace (void) { assert (namespace_sp > 0); current_namespace = namespace_stack[--namespace_sp]; @@ -1270,8 +1185,7 @@ int scope_buffer_len; /* Make sure scope_buffer has enough room to add LEN chars to it. */ void -ensure_scope_buffer_room (len) - int len; +ensure_scope_buffer_room (int len) { if (scope_buffer_len + len >= scope_buffer_size) { @@ -1287,8 +1201,7 @@ ensure_scope_buffer_room (len) scope name constructed. */ char * -sym_scope_1 (p) - struct sym *p; +sym_scope_1 (struct sym *p) { int len; @@ -1322,8 +1235,7 @@ sym_scope_1 (p) as it would appear in a C*+ source file. */ char * -sym_scope (p) - struct sym *p; +sym_scope (struct sym *p) { if (!scope_buffer) { @@ -1345,9 +1257,7 @@ sym_scope (p) list. */ int -dump_members (fp, m) - FILE *fp; - struct member *m; +dump_members (FILE *fp, struct member *m) { int n; @@ -1380,9 +1290,7 @@ dump_members (fp, m) /* Dump class ROOT to stream FP. */ void -dump_sym (fp, root) - FILE *fp; - struct sym *root; +dump_sym (FILE *fp, struct sym *root) { fputs (CLASS_STRUCT, fp); PUTSTR (root->name, fp); @@ -1408,9 +1316,7 @@ dump_sym (fp, root) number of classes written. */ int -dump_tree (fp, root) - FILE *fp; - struct sym *root; +dump_tree (FILE *fp, struct sym *root) { struct link *lk; unsigned n = 0; @@ -1457,8 +1363,7 @@ dump_tree (fp, root) /* Dump the entire class tree to file FP. */ void -dump_roots (fp) - FILE *fp; +dump_roots (FILE *fp) { int i, n = 0; struct sym *r; @@ -1532,7 +1437,7 @@ do { \ input buffer not consumed. */ int -process_pp_line () +process_pp_line (void) { int in_comment = 0, in_string = 0; int c; @@ -1603,7 +1508,7 @@ process_pp_line () /* Value is the next token from the input buffer. */ int -yylex () +yylex (void) { int c; char end_char; @@ -2020,7 +1925,7 @@ static char *matching_regexp_buffer, *matching_regexp_end_buf; shorter than min_regexp. */ char * -matching_regexp () +matching_regexp (void) { char *p; char *s; @@ -2044,7 +1949,7 @@ matching_regexp () while (in - p < min_regexp && p > inbuffer) { /* Line probably not significant enough */ - for (--p; p >= inbuffer && *p != '\n'; --p) + for (--p; p > inbuffer && *p != '\n'; --p) ; } if (*p == '\n') @@ -2070,9 +1975,8 @@ matching_regexp () /* Return a printable representation of token T. */ -char * -token_string (t) - int t; +const char * +token_string (int t) { static char b[3]; @@ -2189,7 +2093,7 @@ token_string (t) /* Reinitialize the scanner for a new input file. */ void -re_init_scanner () +re_init_scanner (void) { in = inbuffer; yyline = 1; @@ -2207,11 +2111,9 @@ re_init_scanner () table. */ void -insert_keyword (name, tk) - char *name; - int tk; +insert_keyword (const char *name, int tk) { - char *s; + const char *s; unsigned h = 0; struct kw *k = (struct kw *) xmalloc (sizeof *k); @@ -2230,7 +2132,7 @@ insert_keyword (name, tk) character class vectors and fills the keyword hash table. */ void -init_scanner () +init_scanner (void) { int i; @@ -2374,8 +2276,7 @@ init_scanner () the current lookahead token after skipping. */ int -skip_to (token) - int token; +skip_to (int token) { while (!LOOKING_AT2 (YYEOF, token)) MATCH (); @@ -2386,7 +2287,7 @@ skip_to (token) angle brackets, curly brackets) matching the current lookahead. */ void -skip_matching () +skip_matching (void) { int open, close, n; @@ -2429,7 +2330,7 @@ skip_matching () } void -skip_initializer () +skip_initializer (void) { for (;;) { @@ -2456,7 +2357,7 @@ skip_initializer () /* Build qualified namespace alias (A::B::c) and return it. */ struct link * -match_qualified_namespace_alias () +match_qualified_namespace_alias (void) { struct link *head = NULL; struct link *cur = NULL; @@ -2469,7 +2370,7 @@ match_qualified_namespace_alias () { case IDENT: tmp = (struct link *) xmalloc (sizeof *cur); - tmp->sym = find_namespace (yytext, cur); + tmp->sym = find_namespace (yytext, cur ? cur->sym : NULL); tmp->next = NULL; if (head) { @@ -2493,7 +2394,7 @@ match_qualified_namespace_alias () /* Re-initialize the parser by resetting the lookahead token. */ void -re_init_parser () +re_init_parser (void) { tk = -1; } @@ -2506,8 +2407,7 @@ re_init_parser () distinguish between overloaded functions. */ unsigned -parm_list (flags) - int *flags; +parm_list (int *flags) { unsigned hash = 0; int type_seen = 0; @@ -2620,7 +2520,7 @@ parm_list (flags) /* Print position info to stdout. */ void -print_info () +print_info (void) { if (info_position >= 0 && BUFFER_POS () <= info_position) if (info_cls) @@ -2635,9 +2535,7 @@ print_info () public). */ void -member (cls, vis) - struct sym *cls; - int vis; +member (struct sym *cls, int vis) { char *id = NULL; int sc = SC_MEMBER; @@ -2759,7 +2657,7 @@ member (cls, vis) if (LOOKING_AT ('{') && id && cls) add_member_defn (cls, id, regexp, pos, hash, 0, sc, flags); - xfree (id); + free (id); id = NULL; sc = SC_MEMBER; break; @@ -2838,7 +2736,7 @@ member (cls, vis) print_info (); } - xfree (id); + free (id); } @@ -2846,9 +2744,7 @@ member (cls, vis) union, class). */ void -class_body (cls, tag) - struct sym *cls; - int tag; +class_body (struct sym *cls, int tag) { int vis = tag == CLASS ? PRIVATE : PUBLIC; int temp; @@ -2909,7 +2805,7 @@ class_body (cls, tag) symbol for that class. */ struct sym * -parse_classname () +parse_classname (void) { struct sym *last_class = NULL; @@ -2939,12 +2835,11 @@ parse_classname () a static buffer holding the constructed operator name string. */ char * -operator_name (sc) - int *sc; +operator_name (int *sc) { static int id_size = 0; static char *id = NULL; - char *s; + const char *s; int len; MATCH (); @@ -3030,8 +2925,7 @@ operator_name (sc) symbol structure for the ident. */ struct sym * -parse_qualified_ident_or_type (last_id) - char **last_id; +parse_qualified_ident_or_type (char **last_id) { struct sym *cls = NULL; char *id = NULL; @@ -3075,7 +2969,7 @@ parse_qualified_ident_or_type (last_id) cls = add_sym (id, cls); *last_id = NULL; - xfree (id); + free (id); id = NULL; id_size = 0; MATCH (); @@ -3096,8 +2990,7 @@ parse_qualified_ident_or_type (last_id) symbol structure for the ident. */ void -parse_qualified_param_ident_or_type (last_id) - char **last_id; +parse_qualified_param_ident_or_type (char **last_id) { struct sym *cls = NULL; static char *id = NULL; @@ -3139,11 +3032,7 @@ parse_qualified_param_ident_or_type (last_id) Current lookahead is the class name. */ void -class_definition (containing, tag, flags, nested) - struct sym *containing; - int tag; - int flags; - int nested; +class_definition (struct sym *containing, int tag, int flags, int nested) { struct sym *current; struct sym *base_class; @@ -3240,10 +3129,7 @@ class_definition (containing, tag, flags, nested) information about the member (see the F_* defines). */ void -add_declarator (cls, id, flags, sc) - struct sym **cls; - char **id; - int flags, sc; +add_declarator (struct sym **cls, char **id, int flags, int sc) { if (LOOKING_AT2 (';', ',')) { @@ -3278,7 +3164,7 @@ add_declarator (cls, id, flags, sc) print_info (); } - xfree (*id); + free (*id); *id = NULL; *cls = NULL; } @@ -3286,8 +3172,7 @@ add_declarator (cls, id, flags, sc) /* Parse a declaration. */ void -declaration (flags) - int flags; +declaration (int flags) { char *id = NULL; struct sym *cls = NULL; @@ -3331,7 +3216,7 @@ declaration (flags) `declare (X, Y)\n class A : ...'. */ if (id) { - xfree (id); + free (id); return; } @@ -3425,7 +3310,7 @@ declaration (flags) if (!cls && id && LOOKING_AT ('{')) add_global_defn (id, regexp, pos, hash, 0, sc, flags); - xfree (id); + free (id); id = NULL; break; } @@ -3441,8 +3326,7 @@ declaration (flags) otherwise. */ int -globals (start_flags) - int start_flags; +globals (int start_flags) { int anonymous; int class_tk; @@ -3481,7 +3365,7 @@ globals (start_flags) MATCH_IF ('}'); } - xfree (namespace_name); + free (namespace_name); } } break; @@ -3560,7 +3444,7 @@ globals (start_flags) /* Parse the current input file. */ void -yyparse () +yyparse (void) { while (globals (0) == 0) MATCH_IF ('}'); @@ -3576,8 +3460,7 @@ yyparse () input files. */ void -add_search_path (path_list) - char *path_list; +add_search_path (char *path_list) { while (*path_list) { @@ -3612,8 +3495,7 @@ add_search_path (path_list) unchanged file name. */ FILE * -open_file (file) - char *file; +open_file (char *file) { FILE *fp = NULL; static char *buffer; @@ -3672,8 +3554,7 @@ Usage: ebrowse [options] {files}\n\ " void -usage (error) - int error; +usage (int error) { puts (USAGE); exit (error ? EXIT_FAILURE : EXIT_SUCCESS); @@ -3688,10 +3569,13 @@ usage (error) #endif void -version () +version (void) { + /* Makes it easier to update automatically. */ + char emacs_copyright[] = "Copyright (C) 2010 Free Software Foundation, Inc."; + printf ("ebrowse %s\n", VERSION); - puts ("Copyright (C) 1992-2007 Free Software Foundation, Inc."); + puts (emacs_copyright); puts ("This program is distributed under the same terms as Emacs."); exit (EXIT_SUCCESS); } @@ -3701,8 +3585,7 @@ version () table. */ void -process_file (file) - char *file; +process_file (char *file) { FILE *fp; @@ -3757,8 +3640,7 @@ process_file (file) is null when EOF is reached. */ char * -read_line (fp) - FILE *fp; +read_line (FILE *fp) { static char *buffer; static int buffer_size; @@ -3794,13 +3676,11 @@ read_line (fp) /* Main entry point. */ int -main (argc, argv) - int argc; - char **argv; +main (int argc, char **argv) { int i; int any_inputfiles = 0; - static char *out_filename = DEFAULT_OUTFILE; + static const char *out_filename = DEFAULT_OUTFILE; static char **input_filenames = NULL; static int input_filenames_size = 0; static int n_input_files;