Skip to content

Commit

Permalink
kconfig: Mark various internal functions static
Browse files Browse the repository at this point in the history
kconfig's keyword hash, lexer, and parser define various functions used
only locally.  Declare these functions as static, and regenerate the
corresponding generated files.

Signed-off-by: Josh Triplett <[email protected]>
  • Loading branch information
joshtriplett committed Nov 15, 2009
1 parent 1456edb commit 6516657
Show file tree
Hide file tree
Showing 6 changed files with 32 additions and 15 deletions.
25 changes: 19 additions & 6 deletions scripts/kconfig/lex.zconf.c_shipped
Original file line number Diff line number Diff line change
Expand Up @@ -160,7 +160,15 @@ typedef unsigned int flex_uint32_t;

/* Size of default input buffer. */
#ifndef YY_BUF_SIZE
#ifdef __ia64__
/* On IA-64, the buffer size is 16k, not 8k.
* Moreover, YY_BUF_SIZE is 2*YY_READ_BUF_SIZE in the general case.
* Ditto for the __ia64__ case accordingly.
*/
#define YY_BUF_SIZE 32768
#else
#define YY_BUF_SIZE 16384
#endif /* __ia64__ */
#endif

/* The state buf must be large enough to hold one state per character in the main buffer.
Expand Down Expand Up @@ -802,15 +810,15 @@ static int last_ts, first_ts;
static void zconf_endhelp(void);
static void zconf_endfile(void);

void new_string(void)
static void new_string(void)
{
text = malloc(START_STRSIZE);
text_asize = START_STRSIZE;
text_size = 0;
*text = 0;
}

void append_string(const char *str, int size)
static void append_string(const char *str, int size)
{
int new_size = text_size + size + 1;
if (new_size > text_asize) {
Expand All @@ -824,7 +832,7 @@ void append_string(const char *str, int size)
text[text_size] = 0;
}

void alloc_string(const char *str, int size)
static void alloc_string(const char *str, int size)
{
text = malloc(size + 1);
memcpy(text, str, size);
Expand Down Expand Up @@ -914,15 +922,20 @@ static int input (void );

/* Amount of stuff to slurp up with each read. */
#ifndef YY_READ_BUF_SIZE
#ifdef __ia64__
/* On IA-64, the buffer size is 16k, not 8k */
#define YY_READ_BUF_SIZE 16384
#else
#define YY_READ_BUF_SIZE 8192
#endif /* __ia64__ */
#endif

/* Copy whatever the last rule matched to the standard output. */
#ifndef ECHO
/* This used to be an fputs(), but since the string might contain NUL's,
* we now use fwrite().
*/
#define ECHO fwrite( zconftext, zconfleng, 1, zconfout )
#define ECHO do { if (fwrite( zconftext, zconfleng, 1, zconfout )) {} } while (0)
#endif

/* Gets input and stuffs it into "buf". number of characters read, or YY_NULL,
Expand Down Expand Up @@ -2060,8 +2073,8 @@ YY_BUFFER_STATE zconf_scan_string (yyconst char * yystr )

/** Setup the input buffer state to scan the given bytes. The next call to zconflex() will
* scan from a @e copy of @a bytes.
* @param bytes the byte buffer to scan
* @param len the number of bytes in the buffer pointed to by @a bytes.
* @param yybytes the byte buffer to scan
* @param _yybytes_len the number of bytes in the buffer pointed to by @a bytes.
*
* @return the newly allocated buffer state object.
*/
Expand Down
2 changes: 2 additions & 0 deletions scripts/kconfig/zconf.gperf
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@

struct kconf_id;

static struct kconf_id *kconf_id_lookup(register const char *str, register unsigned int len);

%%
mainmenu, T_MAINMENU, TF_COMMAND
menu, T_MENU, TF_COMMAND
Expand Down
2 changes: 2 additions & 0 deletions scripts/kconfig/zconf.hash.c_shipped
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,8 @@
#endif

struct kconf_id;

static struct kconf_id *kconf_id_lookup(register const char *str, register unsigned int len);
/* maximum key range = 47, duplicates = 0 */

#ifdef __GNUC__
Expand Down
6 changes: 3 additions & 3 deletions scripts/kconfig/zconf.l
Original file line number Diff line number Diff line change
Expand Up @@ -39,15 +39,15 @@ static int last_ts, first_ts;
static void zconf_endhelp(void);
static void zconf_endfile(void);

void new_string(void)
static void new_string(void)
{
text = malloc(START_STRSIZE);
text_asize = START_STRSIZE;
text_size = 0;
*text = 0;
}

void append_string(const char *str, int size)
static void append_string(const char *str, int size)
{
int new_size = text_size + size + 1;
if (new_size > text_asize) {
Expand All @@ -61,7 +61,7 @@ void append_string(const char *str, int size)
text[text_size] = 0;
}

void alloc_string(const char *str, int size)
static void alloc_string(const char *str, int size)
{
text = malloc(size + 1);
memcpy(text, str, size);
Expand Down
6 changes: 3 additions & 3 deletions scripts/kconfig/zconf.tab.c_shipped
Original file line number Diff line number Diff line change
Expand Up @@ -2249,7 +2249,7 @@ void conf_parse(const char *name)
sym_set_change_count(1);
}

const char *zconf_tokenname(int token)
static const char *zconf_tokenname(int token)
{
switch (token) {
case T_MENU: return "menu";
Expand Down Expand Up @@ -2313,7 +2313,7 @@ static void zconferror(const char *err)
#endif
}

void print_quoted_string(FILE *out, const char *str)
static void print_quoted_string(FILE *out, const char *str)
{
const char *p;
int len;
Expand All @@ -2330,7 +2330,7 @@ void print_quoted_string(FILE *out, const char *str)
putc('"', out);
}

void print_symbol(FILE *out, struct menu *menu)
static void print_symbol(FILE *out, struct menu *menu)
{
struct symbol *sym = menu->sym;
struct property *prop;
Expand Down
6 changes: 3 additions & 3 deletions scripts/kconfig/zconf.y
Original file line number Diff line number Diff line change
Expand Up @@ -504,7 +504,7 @@ void conf_parse(const char *name)
sym_set_change_count(1);
}

const char *zconf_tokenname(int token)
static const char *zconf_tokenname(int token)
{
switch (token) {
case T_MENU: return "menu";
Expand Down Expand Up @@ -568,7 +568,7 @@ static void zconferror(const char *err)
#endif
}

void print_quoted_string(FILE *out, const char *str)
static void print_quoted_string(FILE *out, const char *str)
{
const char *p;
int len;
Expand All @@ -585,7 +585,7 @@ void print_quoted_string(FILE *out, const char *str)
putc('"', out);
}

void print_symbol(FILE *out, struct menu *menu)
static void print_symbol(FILE *out, struct menu *menu)
{
struct symbol *sym = menu->sym;
struct property *prop;
Expand Down

0 comments on commit 6516657

Please sign in to comment.