Branch: Tag:

2004-11-05

2004-11-05 17:56:34 by Henrik Grubbström (Grubba) <grubba@grubba.org>

yywarning() now uses string_builder_vsprintf().

Rev: src/program.c:1.576

2:   || This file is part of Pike. For copyright information see COPYRIGHT.   || Pike is distributed under GPL, LGPL and MPL. See the file COPYING   || for more information. - || $Id: program.c,v 1.575 2004/11/05 16:21:23 grubba Exp $ + || $Id: program.c,v 1.576 2004/11/05 17:56:34 grubba Exp $   */      #include "global.h"
7620:      void yywarning(char *fmt, ...)   { -  char buf[4711]; -  va_list args; -  +     /* If we have parse errors we might get erroneous warnings,    * so don't print them.    * This has the additional benefit of making it easier to
7630:    */    if (Pike_compiler->num_parse_error) return;    +  /* Don't bother generating the warning message if we don't have +  * anywhere to report it... +  */ +  if ((error_handler && error_handler->prog) || get_master()) { +  struct string_builder s; +  va_list args; +  +  init_string_builder(&s, 0);    va_start(args,fmt); -  Pike_vsnprintf (buf, sizeof (buf), fmt, args); +  string_builder_vsprintf(&s, fmt, args);    va_end(args);    -  if ((error_handler && error_handler->prog) || get_master()) { +     ref_push_string(lex.current_file);    push_int(lex.current_line); -  push_text(buf); +  push_string(finish_string_builder(&s));    -  low_safe_apply_handler("compile_warning", error_handler, compat_handler, 3); +  low_safe_apply_handler("compile_warning", +  error_handler, compat_handler, 3);    pop_stack();    }   }