diff options
| author | Simon Tatham <anakin@pobox.com> | 2012-08-29 18:13:11 +0000 |
|---|---|---|
| committer | Simon Tatham <anakin@pobox.com> | 2012-08-29 18:13:11 +0000 |
| commit | 1489dc15967970576d08f3f2b22c6e1c939bcbcf (patch) | |
| tree | 0b27653cc4d5485e273edbf5e8ade37b26b6b44c /bk_html.c | |
| parent | 17fc8b40eb9b3f03945512bf17be99332aeefecb (diff) | |
| download | halibut-1489dc15967970576d08f3f2b22c6e1c939bcbcf.zip halibut-1489dc15967970576d08f3f2b22c6e1c939bcbcf.tar.gz halibut-1489dc15967970576d08f3f2b22c6e1c939bcbcf.tar.bz2 halibut-1489dc15967970576d08f3f2b22c6e1c939bcbcf.tar.xz | |
Revamp of the Halibut error handling mechanism.
I'm not quite sure why I ever thought it was a good idea to have a
central variadic error() function taking an integer error code
followed by some list of arguments that depend on that code. It now
seems obvious to me that it's a much more sensible idea to have a
separate function per error, so that we can check at compile time that
the arguments to each error call are of the right number and type! So
I've done that instead.
A side effect is that the errors are no longer formatted into a
fixed-size buffer before going to stderr, so I can remove all the
%.200s precautions in the format strings.
[originally from svn r9639]
Diffstat (limited to 'bk_html.c')
| -rw-r--r-- | bk_html.c | 14 |
1 files changed, 7 insertions, 7 deletions
@@ -348,7 +348,7 @@ static htmlconfig html_configure(paragraph *source) { break; if (i == lenof(versions)) - error(err_htmlver, &p->fpos, vername); + err_htmlver(&p->fpos, vername); else ret.htmlver = versions[i].ver; } else if (!ustricmp(k, L"html-single-filename")) { @@ -381,7 +381,7 @@ static htmlconfig html_configure(paragraph *source) { frag = adv(frag); } } else - error(err_cfginsufarg, &p->fpos, p->origkeyword, 1); + err_cfginsufarg(&p->fpos, p->origkeyword, 1); } else if (!ustricmp(k, L"html-chapter-numeric")) { ret.achapter.just_numbers = utob(uadv(k)); } else if (!ustricmp(k, L"html-chapter-shownumber")) { @@ -548,7 +548,7 @@ static htmlconfig html_configure(paragraph *source) { * turn both off. */ if (!ret.chm_filename ^ !ret.hhp_filename) { - error(err_chmnames); + err_chmnames(); sfree(ret.chm_filename); ret.chm_filename = NULL; sfree(ret.hhp_filename); ret.hhp_filename = NULL; } @@ -889,7 +889,7 @@ void html_backend(paragraph *sourceform, keywordlist *keywords, else ho.fp = fopen(f->filename, "w"); if (!ho.fp) - error(err_cantopenw, f->filename); + err_cantopenw(f->filename); ho.charset = conf.output_charset; ho.restrict_charset = conf.restrict_charset; @@ -1685,7 +1685,7 @@ void html_backend(paragraph *sourceform, keywordlist *keywords, ho.fp = fopen(conf.hhp_filename, "w"); if (!ho.fp) - error(err_cantopenw, conf.hhp_filename); + err_cantopenw(conf.hhp_filename); fprintf(ho.fp, "[OPTIONS]\n" @@ -1760,7 +1760,7 @@ void html_backend(paragraph *sourceform, keywordlist *keywords, ho.fp = fopen(conf.hhc_filename, "w"); if (!ho.fp) - error(err_cantopenw, conf.hhc_filename); + err_cantopenw(conf.hhc_filename); ho.charset = CS_CP1252; /* as far as I know, HHC files are */ ho.restrict_charset = CS_CP1252; /* hardwired to this charset */ @@ -1874,7 +1874,7 @@ void html_backend(paragraph *sourceform, keywordlist *keywords, ho.fp = fopen(hhk_filename, "w"); if (!ho.fp) - error(err_cantopenw, hhk_filename); + err_cantopenw(hhk_filename); ho.charset = CS_CP1252; /* as far as I know, HHK files are */ ho.restrict_charset = CS_CP1252; /* hardwired to this charset */ |