From: Ken Raeburn Date: Thu, 7 Oct 2004 00:21:38 +0000 (+0000) Subject: * et_c.awk, et_h.awk: Complain if the error table is too large. X-Git-Tag: krb5-1.4-beta1~30 X-Git-Url: http://git.tremily.us/?a=commitdiff_plain;h=8500f37be5f958cc59e38bb2ad3369820670db1a;p=krb5.git * et_c.awk, et_h.awk: Complain if the error table is too large. * et_c.pl, et_h.pl: Regenerated. git-svn-id: svn://anonsvn.mit.edu/krb5/trunk@16811 dc483132-0cff-0310-8789-dd5450dbe970 --- diff --git a/src/util/et/ChangeLog b/src/util/et/ChangeLog index e3c2d7a20..0c7114832 100644 --- a/src/util/et/ChangeLog +++ b/src/util/et/ChangeLog @@ -1,3 +1,8 @@ +2004-10-06 Ken Raeburn + + * et_c.awk, et_h.awk: Complain if the error table is too large. + * et_c.pl, et_h.pl: Regenerated. + 2004-07-03 Ken Raeburn * error_message.c (remove_error_table) [!ENABLE_THREADS && diff --git a/src/util/et/et_c.awk b/src/util/et/et_c.awk index fc2e1ac53..336884235 100644 --- a/src/util/et/et_c.awk +++ b/src/util/et/et_c.awk @@ -184,6 +184,10 @@ c2n["_"]=63 skipone=0 } END { + if (table_item_count > 255) { + print "Error table too large!" | "cat 1>&2" + exit 1 + } print " 0" > outfile print "};" > outfile print "" > outfile diff --git a/src/util/et/et_c.pl b/src/util/et/et_c.pl index f635bc1ac..a4348a409 100644 --- a/src/util/et/et_c.pl +++ b/src/util/et/et_c.pl @@ -144,9 +144,7 @@ line: while (<>) { &Pick('>', $outfile) && (print $fh ''); &Pick('>', $outfile) && - (print $fh - - '#if !defined(_WIN32)'); + (print $fh '#if !defined(_WIN32)'); &Pick('>', $outfile) && (print $fh 'extern void initialize_' . $table_name . @@ -232,6 +230,11 @@ line: while (<>) { $skipone = 0; } +if ($table_item_count > 255) { + &Pick('|', 'cat 1>&2') && + (print $fh 'Error table too large!'); + exit 1; +} &Pick('>', $outfile) && (print $fh ' 0'); &Pick('>', $outfile) && @@ -261,9 +264,7 @@ else { &Pick('>', $outfile) && (print $fh ''); &Pick('>', $outfile) && - (print $fh - - '#if !defined(_WIN32)'); + (print $fh '#if !defined(_WIN32)'); &Pick('>', $outfile) && (print $fh 'void initialize_' . $table_name . '_error_table (void)'); &Pick('>', $outfile) && @@ -279,6 +280,8 @@ else { &Pick('>', $outfile) && (print $fh '#endif'); +exit $ExitValue; + sub Pick { local($mode,$name,$pipe) = @_; $fh = $name; diff --git a/src/util/et/et_h.awk b/src/util/et/et_h.awk index 7a81dfa3f..380083830 100644 --- a/src/util/et/et_h.awk +++ b/src/util/et/et_h.awk @@ -136,6 +136,10 @@ c2n["_"]=63 } END { + if (table_item_count > 255) { + print "Error table too large!" | "cat 1>&2" + exit 1 + } if (tab_base_high == 0) { print "#define ERROR_TABLE_BASE_" table_name " (" \ sprintf("%d", tab_base_sign*tab_base_low) \ diff --git a/src/util/et/et_h.pl b/src/util/et/et_h.pl index 110555098..b5d1ee980 100644 --- a/src/util/et/et_h.pl +++ b/src/util/et/et_h.pl @@ -168,6 +168,11 @@ line: while (<>) { } } +if ($table_item_count > 255) { + &Pick('|', 'cat 1>&2') && + (print $fh 'Error table too large!'); + exit 1; +} if ($tab_base_high == 0) { &Pick('>', $outfile) && (print $fh '#define ERROR_TABLE_BASE_' . $table_name . ' (' . @@ -185,21 +190,29 @@ else { &Pick('>', $outfile) && (print $fh ''); &Pick('>', $outfile) && - (print $fh 'extern struct error_table et_' . $table_name . + (print $fh 'extern const struct error_table et_' . $table_name . '_error_table;'); &Pick('>', $outfile) && (print $fh ''); &Pick('>', $outfile) && - (print $fh - - '#if !defined(_WIN32)'); + (print $fh '#if !defined(_WIN32)'); &Pick('>', $outfile) && (print $fh '/* for compatibility with older versions... */'); &Pick('>', $outfile) && (print $fh 'extern void initialize_' . $table_name . '_error_table () /*@modifies internalState@*/;'); +&Pick('>', $outfile) && + (print $fh '#else'); +&Pick('>', $outfile) && + (print $fh '#define initialize_' . $table_name . '_error_table()'); +&Pick('>', $outfile) && + (print $fh '#endif'); +&Pick('>', $outfile) && + (print $fh ''); +&Pick('>', $outfile) && + (print $fh '#if !defined(_WIN32)'); &Pick('>', $outfile) && (print $fh '#define init_' . $table_name . '_err_tbl initialize_' . @@ -208,13 +221,11 @@ else { (print $fh '#define ' . $table_name . '_err_base ERROR_TABLE_BASE_' . $table_name); -&Pick('>', $outfile) && - (print $fh '#else'); -&Pick('>', $outfile) && - (print $fh '#define initialize_' . $table_name . '_error_table()'); &Pick('>', $outfile) && (print $fh '#endif'); +exit $ExitValue; + sub Pick { local($mode,$name,$pipe) = @_; $fh = $name;