Quick Search:

Mode

Context

Displaying 3 lines of context. None | Less | More | Full

Other Diffs

Ignore

Blank Lines Whitespace: Expand:

Diff

1.177
 
1.178
 
MAIN:plunky:20121017104120
 
cpp.c
_>145145 static void usage(void);
 146146 static usch *xstrdup(const usch *str);
 147147 static void addidir(char *idir, struct incs **ww);
<> 148+static void vsheap(const char *, va_list);
148149 
 149150 int
 150151 main(int argc, char **argv)
     
 !
930931 }
 931932 
 932933 void
<>933 -xwarning(usch *s)
  934+warning(const char *fmt, ...)
934935 {
<>935 -        usch *t;
 936 -        usch *sb = stringbuf;
  936+        va_list ap;
  937+        usch *sb;
937938 
 938939         flbuf();
 939940         savch(0);
<>940 -        if (ifiles != NULL) {
 941 -                t = sheap("%s:%d: warning: ", ifiles->fname, ifiles->lineno);
 942 -                xwrite(2, t, strlen((char *)t));
 943 -        }
 944 -        xwrite(2, s, strlen((char *)s));
 945 -        xwrite(2, "\n", 1);
  941+
  942+        sb = stringbuf;
  943+        if (ifiles != NULL)
  944+                sheap("%s:%d: warning: ", ifiles->fname, ifiles->lineno);
  945+
  946+        va_start(ap, fmt);
  947+        vsheap(fmt, ap);
  948+        va_end(ap);
  949+        savch('\n');
  950+        xwrite(2, sb, stringbuf - sb);
946951         stringbuf = sb;
 947952 }
 948953 
 949954 void
<>950 -xerror(usch *s)
  955+error(const char *fmt, ...)
951956 {
<>952 -        usch *t;
  957+        va_list ap;
  958+        usch *sb;
953959 
 954960         flbuf();
 955961         savch(0);
<>956 -        if (ifiles != NULL) {
 957 -                t = sheap("%s:%d: error: ", ifiles->fname, ifiles->lineno);
 958 -                xwrite(2, t, strlen((char *)t));
 959 -        }
 960 -        xwrite(2, s, strlen((char *)s));
 961 -        xwrite(2, "\n", 1);
  962+
  963+        sb = stringbuf;
  964+        if (ifiles != NULL)
  965+                sheap("%s:%d: error: ", ifiles->fname, ifiles->lineno);
  966+
  967+        va_start(ap, fmt);
  968+        vsheap(fmt, ap);
  969+        va_end(ap);
  970+        savch('\n');
  971+        xwrite(2, sb, stringbuf - sb);
  972+        stringbuf = sb;
  973+
962974         exit(1);
 963975 }
 964976 
     
 !
19341946  * similar to sprintf, but only handles %c, %s and %d.
 19351947  * saves result on heap.
 19361948  */
<>1937 -usch *
 1938 -sheap(const char *fmt, ...)
  1949+static void
  1950+vsheap(const char *fmt, va_list ap)
19391951 {
<>1940 -        va_list ap;
 1941 -        usch *op = stringbuf;
 1942 -
 1943 -        va_start(ap, fmt);
19441952         for (; *fmt; fmt++) {
 19451953                 if (*fmt == '%') {
 19461954                         fmt++;
     
 !
19601968                 } else
 19611969                         savch(*fmt);
 19621970         }
<>1963 -        va_end(ap);
19641971         *stringbuf = 0;
<> 1972+}
  1973+
  1974+usch *
  1975+sheap(const char *fmt, ...)
  1976+{
  1977+        va_list ap;
  1978+        usch *op = stringbuf;
  1979+
  1980+        va_start(ap, fmt);
  1981+        vsheap(fmt, ap);
  1982+        va_end(ap);
  1983+
<_19651984         return op;
 19661985 }
 19671986 
FishEye: Open Source License registered to PCC.
Your maintenance has expired. You can renew your license at http://www.atlassian.com/fisheye/renew
Atlassian FishEye, CVS analysis. (Version:1.6.3 Build:build-336 2008-11-04) - Administration - Page generated 2014-09-15 06:04 +0200