Here is a small simplification: - By inspection of font::name_to_index in src/roff/troff/input.cpp, this function can never return a negative index, since get_charinfo always returns a non-NULL pointer and charset_table[0..255] are always filled by init_charset_table. - The variant of font::name_to_index in src/libs/libgroff/nametoindex.cpp also never returns a negative value. - As a consequence, a few error messages in src/libs/libgroff/font.cpp are redundant.
2006-02-05 Bruno Haible <[EMAIL PROTECTED]> * src/roff/troff/input.cpp (font::name_to_index): Never return a negative value. * src/libs/libgroff/font.cpp (font::load): Remove failure tests for font::name_to_index. diff -r -c3 groff-20060204.orig/src/roff/troff/input.cpp groff-20060204/src/roff/troff/input.cpp --- groff-20060204.orig/src/roff/troff/input.cpp Thu Jul 7 13:16:43 2005 +++ groff-20060204/src/roff/troff/input.cpp Sun Feb 5 23:33:09 2006 @@ -1,5 +1,5 @@ // -*- C++ -*- -/* Copyright (C) 1989, 1990, 1991, 1992, 2000, 2001, 2002, 2003, 2004, 2005 +/* Copyright (C) 1989, 1990, 1991, 1992, 2000, 2001, 2002, 2003, 2004, 2005, 2006 Free Software Foundation, Inc. Written by James Clark ([EMAIL PROTECTED]) @@ -8203,7 +8203,7 @@ else ci = get_charinfo(symbol(nm)); if (ci == 0) - return -1; + abort(); else return ci->get_index(); } diff -r -c3 groff-20060204.orig/src/libs/libgroff/font.cpp groff-20060204/src/libs/libgroff/font.cpp --- groff-20060204.orig/src/libs/libgroff/font.cpp Thu Jul 7 13:16:42 2005 +++ groff-20060204/src/libs/libgroff/font.cpp Sun Feb 5 23:34:36 2006 @@ -1,5 +1,5 @@ // -*- C++ -*- -/* Copyright (C) 1989, 1990, 1991, 1992, 2000, 2001, 2002, 2003, 2004, 2005 +/* Copyright (C) 1989, 1990, 1991, 1992, 2000, 2001, 2002, 2003, 2004, 2005, 2006 Free Software Foundation, Inc. Written by James Clark ([EMAIL PROTECTED]) @@ -677,15 +677,7 @@ return 0; } int i1 = name_to_index(c1); - if (i1 < 0) { - t.error("invalid character `%1'", c1); - return 0; - } int i2 = name_to_index(c2); - if (i2 < 0) { - t.error("invalid character `%1'", c2); - return 0; - } add_kern(i1, i2, n); } } @@ -715,10 +707,6 @@ return 0; } int idx = name_to_index(nm); - if (idx < 0) { - t.error("invalid character `%1'", nm); - return 0; - } copy_entry(idx, last_index); } else { @@ -778,10 +766,6 @@ } else { last_index = name_to_index(nm); - if (last_index < 0) { - t.error("invalid character `%1'", nm); - return 0; - } add_entry(last_index, metric); copy_entry(number_to_index(metric.code), last_index); } _______________________________________________ Groff mailing list Groff@gnu.org http://lists.gnu.org/mailman/listinfo/groff