From c5bea98ddb2f7967df572160f639da3cba381a87 Mon Sep 17 00:00:00 2001 From: Andrew Bartlett Date: Mon, 29 Nov 2010 11:24:08 +1100 Subject: s4:heimdal: import lorikeet-heimdal-201012010201 (commit 81fe27bcc0148d410ca4617f8759b9df1a5e935c) --- source4/heimdal/lib/com_err/com_err.h | 20 --- source4/heimdal/lib/com_err/com_right.h | 35 ++++- source4/heimdal/lib/com_err/error.c | 8 +- source4/heimdal/lib/com_err/lex.c | 83 +++------- source4/heimdal/lib/com_err/lex.h | 2 +- source4/heimdal/lib/com_err/lex.l | 5 +- source4/heimdal/lib/com_err/parse.c | 265 +++++++++++++++++++------------- source4/heimdal/lib/com_err/parse.y | 5 +- 8 files changed, 221 insertions(+), 202 deletions(-) (limited to 'source4/heimdal/lib/com_err') diff --git a/source4/heimdal/lib/com_err/com_err.h b/source4/heimdal/lib/com_err/com_err.h index 1fcfe7f7aa..5b8b7e28f7 100644 --- a/source4/heimdal/lib/com_err/com_err.h +++ b/source4/heimdal/lib/com_err/com_err.h @@ -45,26 +45,6 @@ #define __attribute__(X) #endif -#ifndef KRB5_LIB -#ifndef KRB5_LIB_FUNCTION -#if defined(_WIN32) -#define KRB5_LIB_FUNCTION __declspec(dllimport) -#define KRB5_LIB_CALL __stdcall -#define KRB5_LIB_VARIABLE __declspec(dllimport) -#else -#define KRB5_LIB_FUNCTION -#define KRB5_LIB_CALL -#define KRB5_LIB_VARIABLE -#endif -#endif -#endif - -#ifdef _WIN32 -#define KRB5_CALLCONV __stdcall -#else -#define KRB5_CALLCONV -#endif - typedef void (KRB5_CALLCONV *errf) (const char *, long, const char *, va_list); KRB5_LIB_FUNCTION const char * KRB5_LIB_CALL diff --git a/source4/heimdal/lib/com_err/com_right.h b/source4/heimdal/lib/com_err/com_right.h index e13855abad..b0857d283a 100644 --- a/source4/heimdal/lib/com_err/com_right.h +++ b/source4/heimdal/lib/com_err/com_right.h @@ -36,6 +36,26 @@ #ifndef __COM_RIGHT_H__ #define __COM_RIGHT_H__ +#ifndef KRB5_LIB +#ifndef KRB5_LIB_FUNCTION +#if defined(_WIN32) +#define KRB5_LIB_FUNCTION __declspec(dllimport) +#define KRB5_LIB_CALL __stdcall +#define KRB5_LIB_VARIABLE __declspec(dllimport) +#else +#define KRB5_LIB_FUNCTION +#define KRB5_LIB_CALL +#define KRB5_LIB_VARIABLE +#endif +#endif +#endif + +#ifdef _WIN32 +#define KRB5_CALLCONV __stdcall +#else +#define KRB5_CALLCONV +#endif + #ifdef __STDC__ #include #endif @@ -51,9 +71,16 @@ struct et_list { }; extern struct et_list *_et_list; -const char *com_right (struct et_list *list, long code); -const char *com_right_r (struct et_list *list, long code, char *, size_t); -void initialize_error_table_r (struct et_list **, const char **, int, long); -void free_error_table (struct et_list *); +KRB5_LIB_FUNCTION const char * KRB5_LIB_CALL +com_right (struct et_list *list, long code); + +KRB5_LIB_FUNCTION const char * KRB5_LIB_CALL +com_right_r (struct et_list *list, long code, char *, size_t); + +KRB5_LIB_FUNCTION void KRB5_LIB_CALL +initialize_error_table_r (struct et_list **, const char **, int, long); + +KRB5_LIB_FUNCTION void KRB5_LIB_CALL +free_error_table (struct et_list *); #endif /* __COM_RIGHT_H__ */ diff --git a/source4/heimdal/lib/com_err/error.c b/source4/heimdal/lib/com_err/error.c index 854a4b66cb..0e49a94104 100644 --- a/source4/heimdal/lib/com_err/error.c +++ b/source4/heimdal/lib/com_err/error.c @@ -46,7 +46,7 @@ #define dgettext(d,s) (s) #endif -const char * +KRB5_LIB_FUNCTION const char * KRB5_LIB_CALL com_right(struct et_list *list, long code) { struct et_list *p; @@ -56,7 +56,7 @@ com_right(struct et_list *list, long code) return NULL; } -const char * +KRB5_LIB_FUNCTION const char * KRB5_LIB_CALL com_right_r(struct et_list *list, long code, char *str, size_t len) { struct et_list *p; @@ -79,7 +79,7 @@ struct foobar { struct error_table et; }; -void +KRB5_LIB_FUNCTION void KRB5_LIB_CALL initialize_error_table_r(struct et_list **list, const char **messages, int num_errors, @@ -103,7 +103,7 @@ initialize_error_table_r(struct et_list **list, } -void +KRB5_LIB_FUNCTION void KRB5_LIB_CALL free_error_table(struct et_list *et) { while(et){ diff --git a/source4/heimdal/lib/com_err/lex.c b/source4/heimdal/lib/com_err/lex.c index bf33e3ad0e..f107bba5bd 100644 --- a/source4/heimdal/lib/com_err/lex.c +++ b/source4/heimdal/lib/com_err/lex.c @@ -586,8 +586,6 @@ extern int yywrap (void ); #endif #endif - static void yyunput (int c,char *buf_ptr ); - #ifndef yytext_ptr static void yy_flex_strncpy (char *,yyconst char *,int ); #endif @@ -709,9 +707,9 @@ YY_DECL register char *yy_cp, *yy_bp; register int yy_act; -#line 57 "lex.l" +#line 58 "lex.l" -#line 714 "" +#line 712 "" if ( !(yy_init) ) { @@ -796,86 +794,86 @@ do_action: /* This label is used only to access EOF actions. */ case 1: YY_RULE_SETUP -#line 58 "lex.l" +#line 59 "lex.l" { return ET; } YY_BREAK case 2: YY_RULE_SETUP -#line 59 "lex.l" +#line 60 "lex.l" { return ET; } YY_BREAK case 3: YY_RULE_SETUP -#line 60 "lex.l" +#line 61 "lex.l" { return EC; } YY_BREAK case 4: YY_RULE_SETUP -#line 61 "lex.l" +#line 62 "lex.l" { return EC; } YY_BREAK case 5: YY_RULE_SETUP -#line 62 "lex.l" +#line 63 "lex.l" { return PREFIX; } YY_BREAK case 6: YY_RULE_SETUP -#line 63 "lex.l" +#line 64 "lex.l" { return INDEX; } YY_BREAK case 7: YY_RULE_SETUP -#line 64 "lex.l" +#line 65 "lex.l" { return ID; } YY_BREAK case 8: YY_RULE_SETUP -#line 65 "lex.l" +#line 66 "lex.l" { return END; } YY_BREAK case 9: YY_RULE_SETUP -#line 66 "lex.l" +#line 67 "lex.l" { yylval.number = atoi(yytext); return NUMBER; } YY_BREAK case 10: YY_RULE_SETUP -#line 67 "lex.l" +#line 68 "lex.l" ; YY_BREAK case 11: YY_RULE_SETUP -#line 68 "lex.l" +#line 69 "lex.l" ; YY_BREAK case 12: /* rule 12 can match eol */ YY_RULE_SETUP -#line 69 "lex.l" +#line 70 "lex.l" { lineno++; } YY_BREAK case 13: YY_RULE_SETUP -#line 70 "lex.l" +#line 71 "lex.l" { return getstring(); } YY_BREAK case 14: YY_RULE_SETUP -#line 71 "lex.l" +#line 72 "lex.l" { yylval.string = strdup(yytext); return STRING; } YY_BREAK case 15: YY_RULE_SETUP -#line 72 "lex.l" +#line 73 "lex.l" { return *yytext; } YY_BREAK case 16: YY_RULE_SETUP -#line 73 "lex.l" +#line 74 "lex.l" ECHO; YY_BREAK -#line 878 "" +#line 876 "" case YY_STATE_EOF(INITIAL): yyterminate(); @@ -1204,43 +1202,6 @@ static int yy_get_next_buffer (void) return yy_is_jam ? 0 : yy_current_state; } - static void yyunput (int c, register char * yy_bp ) -{ - register char *yy_cp; - - yy_cp = (yy_c_buf_p); - - /* undo effects of setting up yytext */ - *yy_cp = (yy_hold_char); - - if ( yy_cp < YY_CURRENT_BUFFER_LVALUE->yy_ch_buf + 2 ) - { /* need to shift things up to make room */ - /* +2 for EOB chars. */ - register int number_to_move = (yy_n_chars) + 2; - register char *dest = &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[ - YY_CURRENT_BUFFER_LVALUE->yy_buf_size + 2]; - register char *source = - &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[number_to_move]; - - while ( source > YY_CURRENT_BUFFER_LVALUE->yy_ch_buf ) - *--dest = *--source; - - yy_cp += (int) (dest - source); - yy_bp += (int) (dest - source); - YY_CURRENT_BUFFER_LVALUE->yy_n_chars = - (yy_n_chars) = YY_CURRENT_BUFFER_LVALUE->yy_buf_size; - - if ( yy_cp < YY_CURRENT_BUFFER_LVALUE->yy_ch_buf + 2 ) - YY_FATAL_ERROR( "flex scanner push-back overflow" ); - } - - *--yy_cp = (char) c; - - (yytext_ptr) = yy_bp; - (yy_hold_char) = *yy_cp; - (yy_c_buf_p) = yy_cp; -} - #ifndef YY_NO_INPUT #ifdef __cplusplus static int yyinput (void) @@ -1873,7 +1834,7 @@ void yyfree (void * ptr ) #define YYTABLES_NAME "yytables" -#line 73 "lex.l" +#line 74 "lex.l" @@ -1899,7 +1860,7 @@ getstring(void) continue; } if(c == '\n'){ - error_message("unterminated string"); + lex_error_message("unterminated string"); lineno++; break; } @@ -1919,7 +1880,7 @@ getstring(void) } void -error_message (const char *format, ...) +lex_error_message (const char *format, ...) { va_list args; diff --git a/source4/heimdal/lib/com_err/lex.h b/source4/heimdal/lib/com_err/lex.h index 76f3e2b2a5..6c9be77ddf 100644 --- a/source4/heimdal/lib/com_err/lex.h +++ b/source4/heimdal/lib/com_err/lex.h @@ -33,7 +33,7 @@ /* $Id$ */ -void error_message (const char *, ...) +void lex_error_message (const char *, ...) __attribute__ ((format (printf, 1, 2))); int yylex(void); diff --git a/source4/heimdal/lib/com_err/lex.l b/source4/heimdal/lib/com_err/lex.l index b68814b21c..ac660a1d8c 100644 --- a/source4/heimdal/lib/com_err/lex.l +++ b/source4/heimdal/lib/com_err/lex.l @@ -53,6 +53,7 @@ static int getstring(void); %} +%option nounput %% et { return ET; } @@ -94,7 +95,7 @@ getstring(void) continue; } if(c == '\n'){ - error_message("unterminated string"); + lex_error_message("unterminated string"); lineno++; break; } @@ -114,7 +115,7 @@ getstring(void) } void -error_message (const char *format, ...) +lex_error_message (const char *format, ...) { va_list args; diff --git a/source4/heimdal/lib/com_err/parse.c b/source4/heimdal/lib/com_err/parse.c index a426613303..b2b0fc1090 100644 --- a/source4/heimdal/lib/com_err/parse.c +++ b/source4/heimdal/lib/com_err/parse.c @@ -8,17 +8,29 @@ static const char yysccsid[] = "@(#)yaccpar 1.9 (Berkeley) 02/21/93"; #define YYBYACC 1 #define YYMAJOR 1 #define YYMINOR 9 -#define YYPATCH 20070509 +#define YYPATCH 20100216 -#define YYEMPTY (-1) -#define yyclearin (yychar = YYEMPTY) -#define yyerrok (yyerrflag = 0) -#define YYRECOVERING (yyerrflag != 0) +#define YYEMPTY (-1) +#define yyclearin (yychar = YYEMPTY) +#define yyerrok (yyerrflag = 0) +#define YYRECOVERING() (yyerrflag != 0) -extern int yyparse(void); - -static int yygrowstack(void); #define YYPREFIX "yy" + +/* compatibility with bison */ +#ifdef YYPARSE_PARAM +/* compatibility with FreeBSD */ +#ifdef YYPARSE_PARAM_TYPE +#define YYPARSE_DECL() yyparse(YYPARSE_PARAM_TYPE YYPARSE_PARAM) +#else +#define YYPARSE_DECL() yyparse(void *YYPARSE_PARAM) +#endif +#else +#define YYPARSE_DECL() yyparse(void) +#endif /* YYPARSE_PARAM */ + +extern int YYPARSE_DECL(); + #line 2 "" /* * Copyright (c) 1998 - 2000 Kungliga Tekniska Högskolan @@ -67,12 +79,15 @@ extern char *yytext; #define alloca(x) malloc(x) #endif -#line 51 "" +#define YYMALLOC malloc +#define YYFREE free + +#line 54 "" typedef union { char *string; int number; } YYSTYPE; -#line 76 "" +#line 90 "" #define ET 257 #define INDEX 258 #define PREFIX 259 @@ -82,37 +97,37 @@ typedef union { #define STRING 263 #define NUMBER 264 #define YYERRCODE 256 -short yylhs[] = { -1, +static const short yylhs[] = { -1, 0, 0, 1, 1, 3, 4, 4, 2, 2, 5, 5, 5, 5, 5, }; -short yylen[] = { 2, +static const short yylen[] = { 2, 0, 2, 2, 1, 2, 2, 3, 1, 2, 2, 2, 1, 4, 1, }; -short yydefred[] = { 0, +static const short yydefred[] = { 0, 0, 0, 0, 0, 0, 4, 0, 5, 0, 0, 0, 14, 0, 8, 3, 7, 10, 11, 0, 9, 0, 13, }; -short yydgoto[] = { 3, +static const short yydgoto[] = { 3, 4, 13, 5, 6, 14, }; -short yysindex[] = { -247, +static const short yysindex[] = { -247, -263, -258, 0, -256, -245, 0, -250, 0, -249, -246, -244, 0, -256, 0, 0, 0, 0, 0, -28, 0, -243, 0, }; -short yyrindex[] = { 18, +static const short yyrindex[] = { 18, 0, 0, 0, 0, 0, 0, -251, 0, 0, 1, 0, 0, 21, 0, 0, 0, 0, 0, 0, 0, 0, 0, }; -short yygindex[] = { 0, +static const short yygindex[] = { 0, 0, 0, 0, 17, 10, }; #define YYTABLESIZE 263 -short yytable[] = { 7, +static const short yytable[] = { 7, 12, 9, 10, 11, 8, 12, 6, 6, 6, 1, 6, 1, 16, 2, 17, 21, 18, 1, 19, 22, 2, 15, 20, 0, 0, 0, 0, 0, 0, 0, @@ -141,7 +156,7 @@ short yytable[] = { 7, 0, 0, 0, 0, 0, 0, 0, 0, 12, 12, 12, 0, 12, }; -short yycheck[] = { 263, +static const short yycheck[] = { 263, 0, 258, 259, 260, 263, 262, 258, 259, 260, 257, 262, 257, 263, 261, 264, 44, 263, 0, 263, 263, 0, 5, 13, -1, -1, -1, -1, -1, -1, -1, @@ -176,7 +191,8 @@ short yycheck[] = { 263, #endif #define YYMAXTOKEN 264 #if YYDEBUG -char *yyname[] = { +static const char *yyname[] = { + "end-of-file",0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,"','",0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, @@ -186,7 +202,7 @@ char *yyname[] = { 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,"ET","INDEX","PREFIX","EC", "ID","END","STRING","NUMBER", }; -char *yyrule[] = { +static const char *yyrule[] = { "$accept : file", "file :", "file : header statements", @@ -202,6 +218,7 @@ char *yyrule[] = { "statement : PREFIX", "statement : EC STRING ',' STRING", "statement : END", + }; #endif #if YYDEBUG @@ -225,19 +242,26 @@ char *yyrule[] = { int yydebug; int yynerrs; + +typedef struct { + unsigned stacksize; + short *s_base; + short *s_mark; + short *s_last; + YYSTYPE *l_base; + YYSTYPE *l_mark; +} YYSTACKDATA; + +#define YYPURE 0 + int yyerrflag; int yychar; -short *yyssp; -YYSTYPE *yyvsp; YYSTYPE yyval; YYSTYPE yylval; /* variables for the parser stack */ -static short *yyss; -static short *yysslim; -static YYSTYPE *yyvs; -static int yystacksize; -#line 141 "" +static YYSTACKDATA yystack; +#line 144 "" static long name2number(const char *str) @@ -267,55 +291,70 @@ name2number(const char *str) void yyerror (char *s) { - error_message ("%s\n", s); + lex_error_message ("%s\n", s); } -#line 273 "" +#line 296 "" /* allocate initial stack or double stack size, up to YYMAXDEPTH */ -static int yygrowstack(void) +static int yygrowstack(YYSTACKDATA *data) { - int newsize, i; + int i; + unsigned newsize; short *newss; YYSTYPE *newvs; - if ((newsize = yystacksize) == 0) + if ((newsize = data->stacksize) == 0) newsize = YYINITSTACKSIZE; else if (newsize >= YYMAXDEPTH) return -1; else if ((newsize *= 2) > YYMAXDEPTH) newsize = YYMAXDEPTH; - i = yyssp - yyss; - newss = (yyss != 0) - ? (short *)realloc(yyss, newsize * sizeof(*newss)) + i = data->s_mark - data->s_base; + newss = (data->s_base != 0) + ? (short *)realloc(data->s_base, newsize * sizeof(*newss)) : (short *)malloc(newsize * sizeof(*newss)); if (newss == 0) return -1; - yyss = newss; - yyssp = newss + i; - newvs = (yyvs != 0) - ? (YYSTYPE *)realloc(yyvs, newsize * sizeof(*newvs)) + data->s_base = newss; + data->s_mark = newss + i; + + newvs = (data->l_base != 0) + ? (YYSTYPE *)realloc(data->l_base, newsize * sizeof(*newvs)) : (YYSTYPE *)malloc(newsize * sizeof(*newvs)); if (newvs == 0) return -1; - yyvs = newvs; - yyvsp = newvs + i; - yystacksize = newsize; - yysslim = yyss + newsize - 1; + data->l_base = newvs; + data->l_mark = newvs + i; + + data->stacksize = newsize; + data->s_last = data->s_base + newsize - 1; return 0; } -#define YYABORT goto yyabort +#if YYPURE || defined(YY_NO_LEAKS) +static void yyfreestack(YYSTACKDATA *data) +{ + free(data->s_base); + free(data->l_base); + memset(data, 0, sizeof(*data)); +} +#else +#define yyfreestack(data) /* nothing */ +#endif + +#define YYABORT goto yyabort #define YYREJECT goto yyabort #define YYACCEPT goto yyaccept -#define YYERROR goto yyerrlab +#define YYERROR goto yyerrlab + int -yyparse(void) +YYPARSE_DECL() { - register int yym, yyn, yystate; + int yym, yyn, yystate; #if YYDEBUG - register const char *yys; + const char *yys; if ((yys = getenv("YYDEBUG")) != 0) { @@ -328,11 +367,17 @@ yyparse(void) yynerrs = 0; yyerrflag = 0; yychar = YYEMPTY; + yystate = 0; - if (yyss == NULL && yygrowstack()) goto yyoverflow; - yyssp = yyss; - yyvsp = yyvs; - *yyssp = yystate = 0; +#if YYPURE + memset(&yystack, 0, sizeof(yystack)); +#endif + + if (yystack.s_base == NULL && yygrowstack(&yystack)) goto yyoverflow; + yystack.s_mark = yystack.s_base; + yystack.l_mark = yystack.l_base; + yystate = 0; + *yystack.s_mark = 0; yyloop: if ((yyn = yydefred[yystate]) != 0) goto yyreduce; @@ -358,12 +403,13 @@ yyloop: printf("%sdebug: state %d, shifting to state %d\n", YYPREFIX, yystate, yytable[yyn]); #endif - if (yyssp >= yysslim && yygrowstack()) + if (yystack.s_mark >= yystack.s_last && yygrowstack(&yystack)) { goto yyoverflow; } - *++yyssp = yystate = yytable[yyn]; - *++yyvsp = yylval; + yystate = yytable[yyn]; + *++yystack.s_mark = yytable[yyn]; + *++yystack.l_mark = yylval; yychar = YYEMPTY; if (yyerrflag > 0) --yyerrflag; goto yyloop; @@ -378,9 +424,7 @@ yyloop: yyerror("syntax error"); -#ifdef lint goto yyerrlab; -#endif yyerrlab: ++yynerrs; @@ -391,20 +435,21 @@ yyinrecovery: yyerrflag = 3; for (;;) { - if ((yyn = yysindex[*yyssp]) && (yyn += YYERRCODE) >= 0 && + if ((yyn = yysindex[*yystack.s_mark]) && (yyn += YYERRCODE) >= 0 && yyn <= YYTABLESIZE && yycheck[yyn] == YYERRCODE) { #if YYDEBUG if (yydebug) printf("%sdebug: state %d, error recovery shifting\ - to state %d\n", YYPREFIX, *yyssp, yytable[yyn]); + to state %d\n", YYPREFIX, *yystack.s_mark, yytable[yyn]); #endif - if (yyssp >= yysslim && yygrowstack()) + if (yystack.s_mark >= yystack.s_last && yygrowstack(&yystack)) { goto yyoverflow; } - *++yyssp = yystate = yytable[yyn]; - *++yyvsp = yylval; + yystate = yytable[yyn]; + *++yystack.s_mark = yytable[yyn]; + *++yystack.l_mark = yylval; goto yyloop; } else @@ -412,11 +457,11 @@ yyinrecovery: #if YYDEBUG if (yydebug) printf("%sdebug: error recovery discarding state %d\n", - YYPREFIX, *yyssp); + YYPREFIX, *yystack.s_mark); #endif - if (yyssp <= yyss) goto yyabort; - --yyssp; - --yyvsp; + if (yystack.s_mark <= yystack.s_base) goto yyabort; + --yystack.s_mark; + --yystack.l_mark; } } } @@ -445,53 +490,53 @@ yyreduce: #endif yym = yylen[yyn]; if (yym) - yyval = yyvsp[1-yym]; + yyval = yystack.l_mark[1-yym]; else memset(&yyval, 0, sizeof yyval); switch (yyn) { case 5: -#line 71 "" -{ - id_str = yyvsp[0].string; +#line 74 "" + { + id_str = yystack.l_mark[0].string; } break; case 6: -#line 77 "" -{ - base_id = name2number(yyvsp[0].string); - strlcpy(name, yyvsp[0].string, sizeof(name)); - free(yyvsp[0].string); +#line 80 "" + { + base_id = name2number(yystack.l_mark[0].string); + strlcpy(name, yystack.l_mark[0].string, sizeof(name)); + free(yystack.l_mark[0].string); } break; case 7: -#line 83 "" -{ - base_id = name2number(yyvsp[-1].string); - strlcpy(name, yyvsp[0].string, sizeof(name)); - free(yyvsp[-1].string); - free(yyvsp[0].string); +#line 86 "" + { + base_id = name2number(yystack.l_mark[-1].string); + strlcpy(name, yystack.l_mark[0].string, sizeof(name)); + free(yystack.l_mark[-1].string); + free(yystack.l_mark[0].string); } break; case 10: -#line 96 "" -{ - number = yyvsp[0].number; +#line 99 "" + { + number = yystack.l_mark[0].number; } break; case 11: -#line 100 "" -{ +#line 103 "" + { free(prefix); - asprintf (&prefix, "%s_", yyvsp[0].string); + asprintf (&prefix, "%s_", yystack.l_mark[0].string); if (prefix == NULL) errx(1, "malloc"); - free(yyvsp[0].string); + free(yystack.l_mark[0].string); } break; case 12: -#line 108 "" -{ +#line 111 "" + { prefix = realloc(prefix, 1); if (prefix == NULL) errx(1, "malloc"); @@ -499,8 +544,8 @@ case 12: } break; case 13: -#line 115 "" -{ +#line 118 "" + { struct error_code *ec = malloc(sizeof(*ec)); if (ec == NULL) @@ -509,28 +554,28 @@ case 13: ec->next = NULL; ec->number = number; if(prefix && *prefix != '\0') { - asprintf (&ec->name, "%s%s", prefix, yyvsp[-2].string); + asprintf (&ec->name, "%s%s", prefix, yystack.l_mark[-2].string); if (ec->name == NULL) errx(1, "malloc"); - free(yyvsp[-2].string); + free(yystack.l_mark[-2].string); } else - ec->name = yyvsp[-2].string; - ec->string = yyvsp[0].string; + ec->name = yystack.l_mark[-2].string; + ec->string = yystack.l_mark[0].string; APPEND(codes, ec); number++; } break; case 14: -#line 135 "" -{ +#line 138 "" + { YYACCEPT; } break; -#line 530 "" +#line 574 "" } - yyssp -= yym; - yystate = *yyssp; - yyvsp -= yym; + yystack.s_mark -= yym; + yystate = *yystack.s_mark; + yystack.l_mark -= yym; yym = yylhs[yyn]; if (yystate == 0 && yym == 0) { @@ -540,8 +585,8 @@ break; state %d\n", YYPREFIX, YYFINAL); #endif yystate = YYFINAL; - *++yyssp = YYFINAL; - *++yyvsp = yyval; + *++yystack.s_mark = YYFINAL; + *++yystack.l_mark = yyval; if (yychar < 0) { if ((yychar = yylex()) < 0) yychar = 0; @@ -567,22 +612,24 @@ break; #if YYDEBUG if (yydebug) printf("%sdebug: after reduction, shifting from state %d \ -to state %d\n", YYPREFIX, *yyssp, yystate); +to state %d\n", YYPREFIX, *yystack.s_mark, yystate); #endif - if (yyssp >= yysslim && yygrowstack()) + if (yystack.s_mark >= yystack.s_last && yygrowstack(&yystack)) { goto yyoverflow; } - *++yyssp = yystate; - *++yyvsp = yyval; + *++yystack.s_mark = (short) yystate; + *++yystack.l_mark = yyval; goto yyloop; yyoverflow: yyerror("yacc stack overflow"); yyabort: + yyfreestack(&yystack); return (1); yyaccept: + yyfreestack(&yystack); return (0); } diff --git a/source4/heimdal/lib/com_err/parse.y b/source4/heimdal/lib/com_err/parse.y index d64681d902..f628e8804f 100644 --- a/source4/heimdal/lib/com_err/parse.y +++ b/source4/heimdal/lib/com_err/parse.y @@ -46,6 +46,9 @@ extern char *yytext; #define alloca(x) malloc(x) #endif +#define YYMALLOC malloc +#define YYFREE free + %} %union { @@ -167,5 +170,5 @@ name2number(const char *str) void yyerror (char *s) { - error_message ("%s\n", s); + lex_error_message ("%s\n", s); } -- cgit