aboutsummaryrefslogtreecommitdiffstats
path: root/lib-src
diff options
context:
space:
mode:
authorTom Tromey2013-07-06 23:18:58 -0600
committerTom Tromey2013-07-06 23:18:58 -0600
commit6dacdad5fcb278e5a16b38bb81786aac9ca27be4 (patch)
treef5f331ea361ba0f99e0f9b638d183ad492a7da31 /lib-src
parent0a6f2ff0c8ceb29703e76cddd46ea3f176dd873a (diff)
parent219afb88d9d484393418820d1c08dc93299110ec (diff)
downloademacs-6dacdad5fcb278e5a16b38bb81786aac9ca27be4.tar.gz
emacs-6dacdad5fcb278e5a16b38bb81786aac9ca27be4.zip
merge from trunk
this merges frmo trunk and fixes various build issues. this needed a few ugly tweaks. this hangs in "make check" now
Diffstat (limited to 'lib-src')
-rw-r--r--lib-src/ChangeLog23
-rw-r--r--lib-src/Makefile.in12
-rw-r--r--lib-src/ebrowse.c22
-rw-r--r--lib-src/etags.c20
-rw-r--r--lib-src/make-docfile.c2
5 files changed, 48 insertions, 31 deletions
diff --git a/lib-src/ChangeLog b/lib-src/ChangeLog
index e1025fc5f6b..4a43a741e54 100644
--- a/lib-src/ChangeLog
+++ b/lib-src/ChangeLog
@@ -1,3 +1,22 @@
12013-07-02 Paul Eggert <eggert@cs.ucla.edu>
2
3 Prefer plain 'static' to 'static inline' (Bug#12541).
4 I missed these instances of 'static inline' in an earlier sweep.
5 * ebrowse.c (putstr):
6 * etags.c (hash):
7 * make-docfile.c (put_char): No longer inline.
8 * etags.c (hash): Prefer int to unsigned when either will do.
9
102013-06-21 Paul Eggert <eggert@cs.ucla.edu>
11
12 Use C99-style flexible array members if available.
13 * ebrowse.c: Include <stddef.h>, for offsetof.
14 (struct member, struct alias, struct sym):
15 Use FLEXIBLE_ARRAY_MEMBER.
16 (add_sym, add_member, make_namespace, register_namespace_alias):
17 Use offsetof (struct, flex_array_member), not sizeof (struct), as
18 that ports better to pre-C99 non-GCC.
19
12013-05-29 Eli Zaretskii <eliz@gnu.org> 202013-05-29 Eli Zaretskii <eliz@gnu.org>
2 21
3 * Makefile.in (mostlyclean): Remove *.res files. 22 * Makefile.in (mostlyclean): Remove *.res files.
@@ -717,7 +736,7 @@
717 to avoid potential buffer overflow issues on typical 64-bit hosts. 736 to avoid potential buffer overflow issues on typical 64-bit hosts.
718 (whatlen_max): New static var. 737 (whatlen_max): New static var.
719 (main): Avoid buffer overflow if subsidiary command length is 738 (main): Avoid buffer overflow if subsidiary command length is
720 greater than BUFSIZ or 2*BUFSIZ + 20. Do not use sprintf when its 739 greater than BUFSIZ or 2*BUFSIZ + 20. Do not use sprintf when its
721 result might not fit in 'int'. 740 result might not fit in 'int'.
722 741
723 * movemail.c (main): Do not use sprintf when its result might not fit 742 * movemail.c (main): Do not use sprintf when its result might not fit
@@ -8408,7 +8427,7 @@
8408 8427
84091988-12-31 Richard Mlynarik (mly@rice-chex.ai.mit.edu) 84281988-12-31 Richard Mlynarik (mly@rice-chex.ai.mit.edu)
8410 8429
8411 * env.c: Add decl for my-index 8430 * env.c: Add decl for my-index.
8412 * etags.c (file-entries): .oak => scheme. 8431 * etags.c (file-entries): .oak => scheme.
8413 8432
84141988-12-30 Richard Stallman (rms@sugar-bombs.ai.mit.edu) 84331988-12-30 Richard Stallman (rms@sugar-bombs.ai.mit.edu)
diff --git a/lib-src/Makefile.in b/lib-src/Makefile.in
index f32333fe765..2e0e2818767 100644
--- a/lib-src/Makefile.in
+++ b/lib-src/Makefile.in
@@ -146,17 +146,17 @@ MOVE_FLAGS=
146## Empty if either MAIL_USE_FLOCK or MAIL_USE_LOCKF, else need-blessmail. 146## Empty if either MAIL_USE_FLOCK or MAIL_USE_LOCKF, else need-blessmail.
147BLESSMAIL_TARGET=@BLESSMAIL_TARGET@ 147BLESSMAIL_TARGET=@BLESSMAIL_TARGET@
148 148
149## -lkrb if HAVE_LIBKRB or -lkrb4 if HAVE_LIBKRB4 149## -lkrb or -lkrb4 if needed
150KRB4LIB=@KRB4LIB@ 150KRB4LIB=@KRB4LIB@
151## -ldes if HAVE_LIBDES or -ldes425 if HAVE_LIBDES425 151## -ldes or -ldes425 if needed
152DESLIB=@DESLIB@ 152DESLIB=@DESLIB@
153## -lkrb5 if HAVE_LIBKRB5 153## -lkrb5 if needed
154KRB5LIB=@KRB5LIB@ 154KRB5LIB=@KRB5LIB@
155## -lk5crypto if HAVE_LIBK5CRYPTO or -lcrypto if HAVE_LIBCRYPTO 155## -lk5crypto or -lcrypto if needed
156CRYPTOLIB=@CRYPTOLIB@ 156CRYPTOLIB=@CRYPTOLIB@
157## -lcom_err if HAVE_LIBCOM_ERR 157## -lcom_err if needed
158COM_ERRLIB=@COM_ERRLIB@ 158COM_ERRLIB=@COM_ERRLIB@
159## -lhesiod if HAVE_LIBHESIOD 159## -lhesiod if needed
160LIBHESIOD=@LIBHESIOD@ 160LIBHESIOD=@LIBHESIOD@
161## -lresolv if HAVE_LIBRESOLV 161## -lresolv if HAVE_LIBRESOLV
162LIBRESOLV=@LIBRESOLV@ 162LIBRESOLV=@LIBRESOLV@
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,
852static struct member * 853static struct member *
853add_member (struct sym *cls, char *name, int var, int sc, unsigned int hash) 854add_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)
962static struct sym * 964static struct sym *
963make_namespace (char *name, struct sym *context) 965make_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
1097static inline void 1099static void
1098putstr (const char *s, FILE *fp) 1100putstr (const char *s, FILE *fp)
1099{ 1101{
1100 if (!s) 1102 if (!s)
diff --git a/lib-src/etags.c b/lib-src/etags.c
index f6b173bf465..aa8c773e357 100644
--- a/lib-src/etags.c
+++ b/lib-src/etags.c
@@ -2240,10 +2240,6 @@ enum sym_type
2240 st_C_struct, st_C_extern, st_C_enum, st_C_define, st_C_typedef 2240 st_C_struct, st_C_extern, st_C_enum, st_C_define, st_C_typedef
2241}; 2241};
2242 2242
2243static unsigned int hash (const char *, unsigned int);
2244static struct C_stab_entry * in_word_set (const char *, unsigned int);
2245static enum sym_type C_symtype (char *, int, int);
2246
2247/* Feed stuff between (but not including) %[ and %] lines to: 2243/* Feed stuff between (but not including) %[ and %] lines to:
2248 gperf -m 5 2244 gperf -m 5
2249%[ 2245%[
@@ -2302,10 +2298,10 @@ and replace lines between %< and %> with its output, then:
2302struct C_stab_entry { const char *name; int c_ext; enum sym_type type; }; 2298struct C_stab_entry { const char *name; int c_ext; enum sym_type type; };
2303/* maximum key range = 33, duplicates = 0 */ 2299/* maximum key range = 33, duplicates = 0 */
2304 2300
2305static inline unsigned int 2301static int
2306hash (register const char *str, register unsigned int len) 2302hash (const char *str, int len)
2307{ 2303{
2308 static unsigned char asso_values[] = 2304 static char const asso_values[] =
2309 { 2305 {
2310 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 2306 35, 35, 35, 35, 35, 35, 35, 35, 35, 35,
2311 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 2307 35, 35, 35, 35, 35, 35, 35, 35, 35, 35,
@@ -2334,15 +2330,15 @@ hash (register const char *str, register unsigned int len)
2334 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 2330 35, 35, 35, 35, 35, 35, 35, 35, 35, 35,
2335 35, 35, 35, 35, 35, 35 2331 35, 35, 35, 35, 35, 35
2336 }; 2332 };
2337 register int hval = len; 2333 int hval = len;
2338 2334
2339 switch (hval) 2335 switch (hval)
2340 { 2336 {
2341 default: 2337 default:
2342 hval += asso_values[(unsigned char)str[2]]; 2338 hval += asso_values[(unsigned char) str[2]];
2343 /*FALLTHROUGH*/ 2339 /*FALLTHROUGH*/
2344 case 2: 2340 case 2:
2345 hval += asso_values[(unsigned char)str[1]]; 2341 hval += asso_values[(unsigned char) str[1]];
2346 break; 2342 break;
2347 } 2343 }
2348 return hval; 2344 return hval;
@@ -2400,11 +2396,11 @@ in_word_set (register const char *str, register unsigned int len)
2400 2396
2401 if (len <= MAX_WORD_LENGTH && len >= MIN_WORD_LENGTH) 2397 if (len <= MAX_WORD_LENGTH && len >= MIN_WORD_LENGTH)
2402 { 2398 {
2403 register int key = hash (str, len); 2399 int key = hash (str, len);
2404 2400
2405 if (key <= MAX_HASH_VALUE && key >= 0) 2401 if (key <= MAX_HASH_VALUE && key >= 0)
2406 { 2402 {
2407 register const char *s = wordlist[key].name; 2403 const char *s = wordlist[key].name;
2408 2404
2409 if (*str == *s && !strncmp (str + 1, s + 1, len - 1) && s[len] == '\0') 2405 if (*str == *s && !strncmp (str + 1, s + 1, len - 1) && s[len] == '\0')
2410 return &wordlist[key]; 2406 return &wordlist[key];
diff --git a/lib-src/make-docfile.c b/lib-src/make-docfile.c
index 8fa70dd430e..9bc91bc4f77 100644
--- a/lib-src/make-docfile.c
+++ b/lib-src/make-docfile.c
@@ -276,7 +276,7 @@ struct rcsoc_state
276/* Output CH to the file or buffer in STATE. Any pending newlines or 276/* Output CH to the file or buffer in STATE. Any pending newlines or
277 spaces are output first. */ 277 spaces are output first. */
278 278
279static inline void 279static void
280put_char (int ch, struct rcsoc_state *state) 280put_char (int ch, struct rcsoc_state *state)
281{ 281{
282 int out_ch; 282 int out_ch;