summaryrefslogtreecommitdiff
path: root/lib-src
diff options
context:
space:
mode:
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 @@
+2013-07-02 Paul Eggert <eggert@cs.ucla.edu>
+
+ Prefer plain 'static' to 'static inline' (Bug#12541).
+ I missed these instances of 'static inline' in an earlier sweep.
+ * ebrowse.c (putstr):
+ * etags.c (hash):
+ * make-docfile.c (put_char): No longer inline.
+ * etags.c (hash): Prefer int to unsigned when either will do.
+
+2013-06-21 Paul Eggert <eggert@cs.ucla.edu>
+
+ Use C99-style flexible array members if available.
+ * ebrowse.c: Include <stddef.h>, for offsetof.
+ (struct member, struct alias, struct sym):
+ Use FLEXIBLE_ARRAY_MEMBER.
+ (add_sym, add_member, make_namespace, register_namespace_alias):
+ Use offsetof (struct, flex_array_member), not sizeof (struct), as
+ that ports better to pre-C99 non-GCC.
+
2013-05-29 Eli Zaretskii <eliz@gnu.org>
* Makefile.in (mostlyclean): Remove *.res files.
@@ -717,7 +736,7 @@
to avoid potential buffer overflow issues on typical 64-bit hosts.
(whatlen_max): New static var.
(main): Avoid buffer overflow if subsidiary command length is
- greater than BUFSIZ or 2*BUFSIZ + 20. Do not use sprintf when its
+ greater than BUFSIZ or 2*BUFSIZ + 20. Do not use sprintf when its
result might not fit in 'int'.
* movemail.c (main): Do not use sprintf when its result might not fit
@@ -8408,7 +8427,7 @@
1988-12-31 Richard Mlynarik (mly@rice-chex.ai.mit.edu)
- * env.c: Add decl for my-index
+ * env.c: Add decl for my-index.
* etags.c (file-entries): .oak => scheme.
1988-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=
## Empty if either MAIL_USE_FLOCK or MAIL_USE_LOCKF, else need-blessmail.
BLESSMAIL_TARGET=@BLESSMAIL_TARGET@
-## -lkrb if HAVE_LIBKRB or -lkrb4 if HAVE_LIBKRB4
+## -lkrb or -lkrb4 if needed
KRB4LIB=@KRB4LIB@
-## -ldes if HAVE_LIBDES or -ldes425 if HAVE_LIBDES425
+## -ldes or -ldes425 if needed
DESLIB=@DESLIB@
-## -lkrb5 if HAVE_LIBKRB5
+## -lkrb5 if needed
KRB5LIB=@KRB5LIB@
-## -lk5crypto if HAVE_LIBK5CRYPTO or -lcrypto if HAVE_LIBCRYPTO
+## -lk5crypto or -lcrypto if needed
CRYPTOLIB=@CRYPTOLIB@
-## -lcom_err if HAVE_LIBCOM_ERR
+## -lcom_err if needed
COM_ERRLIB=@COM_ERRLIB@
-## -lhesiod if HAVE_LIBHESIOD
+## -lhesiod if needed
LIBHESIOD=@LIBHESIOD@
## -lresolv if HAVE_LIBRESOLV
LIBRESOLV=@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/>. */
#include <config.h>
+#include <stddef.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
@@ -237,7 +238,7 @@ struct member
char *def_regexp; /* Regular expression matching definition. */
const char *def_filename; /* File name of definition. */
int def_pos; /* Buffer position of definition. */
- char name[1]; /* Member name. */
+ char name[FLEXIBLE_ARRAY_MEMBER]; /* Member name. */
};
/* Structures of this type are used to connect class structures with
@@ -256,7 +257,7 @@ struct alias
struct alias *next; /* Next in list. */
struct sym *namesp; /* Namespace in which defined. */
struct link *aliasee; /* List of aliased namespaces (A::B::C...). */
- char name[1]; /* Alias name. */
+ char name[FLEXIBLE_ARRAY_MEMBER]; /* Alias name. */
};
/* The structure used to describe a class in the symbol table,
@@ -280,7 +281,7 @@ struct sym
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. */
+ char name[FLEXIBLE_ARRAY_MEMBER]; /* Name of the class. */
};
/* Experimental: Print info for `--position-info'. We print
@@ -567,8 +568,8 @@ add_sym (const char *name, struct sym *nested_in_class)
puts (name);
}
- sym = (struct sym *) xmalloc (sizeof *sym + strlen (name));
- memset (sym, 0, sizeof *sym);
+ sym = xmalloc (offsetof (struct sym, name) + strlen (name) + 1);
+ memset (sym, 0, offsetof (struct sym, name));
strcpy (sym->name, name);
sym->namesp = scope;
sym->next = class_table[h];
@@ -852,7 +853,8 @@ add_global_decl (char *name, char *regexp, int pos, unsigned int hash, int var,
static struct member *
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 *m = xmalloc (offsetof (struct member, name)
+ + strlen (name) + 1);
struct member **list;
struct member *p;
struct member *prev;
@@ -962,8 +964,8 @@ mark_inherited_virtual (void)
static struct sym *
make_namespace (char *name, struct sym *context)
{
- struct sym *s = (struct sym *) xmalloc (sizeof *s + strlen (name));
- memset (s, 0, sizeof *s);
+ struct sym *s = xmalloc (offsetof (struct sym, name) + strlen (name) + 1);
+ memset (s, 0, offsetof (struct sym, name));
strcpy (s->name, name);
s->next = all_namespaces;
s->namesp = context;
@@ -1046,7 +1048,7 @@ register_namespace_alias (char *new_name, struct link *old_name)
if (streq (new_name, al->name) && (al->namesp == current_namespace))
return;
- al = (struct alias *) xmalloc (sizeof *al + strlen (new_name));
+ al = xmalloc (offsetof (struct alias, name) + strlen (new_name) + 1);
strcpy (al->name, new_name);
al->next = namespace_alias_table[h];
al->namesp = current_namespace;
@@ -1094,7 +1096,7 @@ leave_namespace (void)
/* Write string S to the output file FP in a Lisp-readable form.
If S is null, write out `()'. */
-static inline void
+static void
putstr (const char *s, FILE *fp)
{
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
st_C_struct, st_C_extern, st_C_enum, st_C_define, st_C_typedef
};
-static unsigned int hash (const char *, unsigned int);
-static struct C_stab_entry * in_word_set (const char *, unsigned int);
-static enum sym_type C_symtype (char *, int, int);
-
/* Feed stuff between (but not including) %[ and %] lines to:
gperf -m 5
%[
@@ -2302,10 +2298,10 @@ and replace lines between %< and %> with its output, then:
struct C_stab_entry { const char *name; int c_ext; enum sym_type type; };
/* maximum key range = 33, duplicates = 0 */
-static inline unsigned int
-hash (register const char *str, register unsigned int len)
+static int
+hash (const char *str, int len)
{
- static unsigned char asso_values[] =
+ static char const asso_values[] =
{
35, 35, 35, 35, 35, 35, 35, 35, 35, 35,
35, 35, 35, 35, 35, 35, 35, 35, 35, 35,
@@ -2334,15 +2330,15 @@ hash (register const char *str, register unsigned int len)
35, 35, 35, 35, 35, 35, 35, 35, 35, 35,
35, 35, 35, 35, 35, 35
};
- register int hval = len;
+ int hval = len;
switch (hval)
{
default:
- hval += asso_values[(unsigned char)str[2]];
+ hval += asso_values[(unsigned char) str[2]];
/*FALLTHROUGH*/
case 2:
- hval += asso_values[(unsigned char)str[1]];
+ hval += asso_values[(unsigned char) str[1]];
break;
}
return hval;
@@ -2400,11 +2396,11 @@ in_word_set (register const char *str, register unsigned int len)
if (len <= MAX_WORD_LENGTH && len >= MIN_WORD_LENGTH)
{
- register int key = hash (str, len);
+ int key = hash (str, len);
if (key <= MAX_HASH_VALUE && key >= 0)
{
- register const char *s = wordlist[key].name;
+ const char *s = wordlist[key].name;
if (*str == *s && !strncmp (str + 1, s + 1, len - 1) && s[len] == '\0')
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
/* Output CH to the file or buffer in STATE. Any pending newlines or
spaces are output first. */
-static inline void
+static void
put_char (int ch, struct rcsoc_state *state)
{
int out_ch;