diff options
| author | Joakim Verona | 2013-07-02 22:46:17 +0200 |
|---|---|---|
| committer | Joakim Verona | 2013-07-02 22:46:17 +0200 |
| commit | 3718127221fbbc31f8ebd027ab7c95403dbe9118 (patch) | |
| tree | ef422898f3344c8f94f6ecf63eb583122bbf2bd8 /lib-src/ebrowse.c | |
| parent | 1ce45b902c67b8a0dda8d71bd2812de29a9988a6 (diff) | |
| parent | a3b49114c186d84404226af75ae7905bd1cd018f (diff) | |
| download | emacs-3718127221fbbc31f8ebd027ab7c95403dbe9118.tar.gz emacs-3718127221fbbc31f8ebd027ab7c95403dbe9118.zip | |
Merge branch 'trunk' into xwidget
Conflicts:
src/window.c
Diffstat (limited to 'lib-src/ebrowse.c')
| -rw-r--r-- | lib-src/ebrowse.c | 22 |
1 files changed, 12 insertions, 10 deletions
diff --git a/lib-src/ebrowse.c b/lib-src/ebrowse.c index 3a237daf5f8..407f769afc8 100644 --- a/lib-src/ebrowse.c +++ b/lib-src/ebrowse.c | |||
| @@ -19,6 +19,7 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */ | |||
| 19 | 19 | ||
| 20 | 20 | ||
| 21 | #include <config.h> | 21 | #include <config.h> |
| 22 | #include <stddef.h> | ||
| 22 | #include <stdio.h> | 23 | #include <stdio.h> |
| 23 | #include <stdlib.h> | 24 | #include <stdlib.h> |
| 24 | #include <string.h> | 25 | #include <string.h> |
| @@ -237,7 +238,7 @@ struct member | |||
| 237 | char *def_regexp; /* Regular expression matching definition. */ | 238 | char *def_regexp; /* Regular expression matching definition. */ |
| 238 | const char *def_filename; /* File name of definition. */ | 239 | const char *def_filename; /* File name of definition. */ |
| 239 | int def_pos; /* Buffer position of definition. */ | 240 | int def_pos; /* Buffer position of definition. */ |
| 240 | char name[1]; /* Member name. */ | 241 | char name[FLEXIBLE_ARRAY_MEMBER]; /* Member name. */ |
| 241 | }; | 242 | }; |
| 242 | 243 | ||
| 243 | /* Structures of this type are used to connect class structures with | 244 | /* Structures of this type are used to connect class structures with |
| @@ -256,7 +257,7 @@ struct alias | |||
| 256 | struct alias *next; /* Next in list. */ | 257 | struct alias *next; /* Next in list. */ |
| 257 | struct sym *namesp; /* Namespace in which defined. */ | 258 | struct sym *namesp; /* Namespace in which defined. */ |
| 258 | struct link *aliasee; /* List of aliased namespaces (A::B::C...). */ | 259 | struct link *aliasee; /* List of aliased namespaces (A::B::C...). */ |
| 259 | char name[1]; /* Alias name. */ | 260 | char name[FLEXIBLE_ARRAY_MEMBER]; /* Alias name. */ |
| 260 | }; | 261 | }; |
| 261 | 262 | ||
| 262 | /* The structure used to describe a class in the symbol table, | 263 | /* The structure used to describe a class in the symbol table, |
| @@ -280,7 +281,7 @@ struct sym | |||
| 280 | const char *filename; /* File in which it can be found. */ | 281 | const char *filename; /* File in which it can be found. */ |
| 281 | const char *sfilename; /* File in which members can be found. */ | 282 | const char *sfilename; /* File in which members can be found. */ |
| 282 | struct sym *namesp; /* Namespace in which defined. . */ | 283 | struct sym *namesp; /* Namespace in which defined. . */ |
| 283 | char name[1]; /* Name of the class. */ | 284 | char name[FLEXIBLE_ARRAY_MEMBER]; /* Name of the class. */ |
| 284 | }; | 285 | }; |
| 285 | 286 | ||
| 286 | /* Experimental: Print info for `--position-info'. We print | 287 | /* Experimental: Print info for `--position-info'. We print |
| @@ -567,8 +568,8 @@ add_sym (const char *name, struct sym *nested_in_class) | |||
| 567 | puts (name); | 568 | puts (name); |
| 568 | } | 569 | } |
| 569 | 570 | ||
| 570 | sym = (struct sym *) xmalloc (sizeof *sym + strlen (name)); | 571 | sym = xmalloc (offsetof (struct sym, name) + strlen (name) + 1); |
| 571 | memset (sym, 0, sizeof *sym); | 572 | memset (sym, 0, offsetof (struct sym, name)); |
| 572 | strcpy (sym->name, name); | 573 | strcpy (sym->name, name); |
| 573 | sym->namesp = scope; | 574 | sym->namesp = scope; |
| 574 | sym->next = class_table[h]; | 575 | sym->next = class_table[h]; |
| @@ -852,7 +853,8 @@ add_global_decl (char *name, char *regexp, int pos, unsigned int hash, int var, | |||
| 852 | static struct member * | 853 | static struct member * |
| 853 | add_member (struct sym *cls, char *name, int var, int sc, unsigned int hash) | 854 | add_member (struct sym *cls, char *name, int var, int sc, unsigned int hash) |
| 854 | { | 855 | { |
| 855 | struct member *m = (struct member *) xmalloc (sizeof *m + strlen (name)); | 856 | struct member *m = xmalloc (offsetof (struct member, name) |
| 857 | + strlen (name) + 1); | ||
| 856 | struct member **list; | 858 | struct member **list; |
| 857 | struct member *p; | 859 | struct member *p; |
| 858 | struct member *prev; | 860 | struct member *prev; |
| @@ -962,8 +964,8 @@ mark_inherited_virtual (void) | |||
| 962 | static struct sym * | 964 | static struct sym * |
| 963 | make_namespace (char *name, struct sym *context) | 965 | make_namespace (char *name, struct sym *context) |
| 964 | { | 966 | { |
| 965 | struct sym *s = (struct sym *) xmalloc (sizeof *s + strlen (name)); | 967 | struct sym *s = xmalloc (offsetof (struct sym, name) + strlen (name) + 1); |
| 966 | memset (s, 0, sizeof *s); | 968 | memset (s, 0, offsetof (struct sym, name)); |
| 967 | strcpy (s->name, name); | 969 | strcpy (s->name, name); |
| 968 | s->next = all_namespaces; | 970 | s->next = all_namespaces; |
| 969 | s->namesp = context; | 971 | s->namesp = context; |
| @@ -1046,7 +1048,7 @@ register_namespace_alias (char *new_name, struct link *old_name) | |||
| 1046 | if (streq (new_name, al->name) && (al->namesp == current_namespace)) | 1048 | if (streq (new_name, al->name) && (al->namesp == current_namespace)) |
| 1047 | return; | 1049 | return; |
| 1048 | 1050 | ||
| 1049 | al = (struct alias *) xmalloc (sizeof *al + strlen (new_name)); | 1051 | al = xmalloc (offsetof (struct alias, name) + strlen (new_name) + 1); |
| 1050 | strcpy (al->name, new_name); | 1052 | strcpy (al->name, new_name); |
| 1051 | al->next = namespace_alias_table[h]; | 1053 | al->next = namespace_alias_table[h]; |
| 1052 | al->namesp = current_namespace; | 1054 | al->namesp = current_namespace; |
| @@ -1094,7 +1096,7 @@ leave_namespace (void) | |||
| 1094 | /* Write string S to the output file FP in a Lisp-readable form. | 1096 | /* Write string S to the output file FP in a Lisp-readable form. |
| 1095 | If S is null, write out `()'. */ | 1097 | If S is null, write out `()'. */ |
| 1096 | 1098 | ||
| 1097 | static inline void | 1099 | static void |
| 1098 | putstr (const char *s, FILE *fp) | 1100 | putstr (const char *s, FILE *fp) |
| 1099 | { | 1101 | { |
| 1100 | if (!s) | 1102 | if (!s) |