/[CvsGraph]/cvsgraph/utils.c
ViewVC logotype

Annotate of /cvsgraph/utils.c

Parent Directory Parent Directory | Revision Log Revision Log | View Revision Graph Revision Graph


Revision 1.2 - (show annotations)
Sat Feb 24 00:35:13 2001 UTC (16 years, 8 months ago) by bertho
Branch: MAIN
CVS Tags: REL_1_0_1
Changes since 1.1: +11 -0 lines
File MIME type: text/plain
Fixed the soring of revisions permanently. All sections of the revision
numbers are important.
Implemented better control over libgd with autoconf and added support
for generation of png and jpeg from the configuration file (thanks to
Kurt L. Sussman for a patch, although I modified it a bit).
1 /*
2 * CvsGraph graphical representation generator of brances and revisions
3 * of a file in cvs/rcs.
4 *
5 * Copyright (C) 2001 B. Stultiens
6 *
7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License as published by
9 * the Free Software Foundation; either version 2 of the License, or
10 * (at your option) any later version.
11 *
12 * This program is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 * GNU General Public License for more details.
16 *
17 * You should have received a copy of the GNU General Public License
18 * along with this program; if not, write to the Free Software
19 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
20 */
21
22 #include <stdio.h>
23 #include <stdlib.h>
24 #include <stdarg.h>
25 #include <string.h>
26
27 #include "utils.h"
28 #include "readconf.h"
29
30 void *xmalloc(size_t s)
31 {
32 void *p = malloc(s);
33 if(!p)
34 {
35 printf("Out of memory");
36 exit(1);
37 }
38 memset(p, 0, s);
39 return p;
40 }
41
42 void *xrealloc(void *a, size_t s)
43 {
44 void *p;
45 if(!a)
46 return malloc(s);
47 p = realloc(a, s);
48 if(!p)
49 {
50 printf("Out of memory");
51 exit(1);
52 }
53 return p;
54 }
55
56 char *xstrdup(const char *s)
57 {
58 char *c;
59 if(!s)
60 s = "";
61 c = xmalloc(strlen(s)+1);
62 strcpy(c, s);
63 return c;
64 }
65
66 void xfree(void *p)
67 {
68 if(p)
69 free(p);
70 }
71
72 int yyerror(const char *fmt, ...)
73 {
74 va_list va;
75 va_start(va, fmt);
76 fprintf(stderr, "error: %d: ", line_number);
77 vfprintf(stderr, fmt, va);
78 fprintf(stderr, "\n");
79 va_end(va);
80 exit(2);
81 return 0;
82 }
83
84 int yywarning(const char *fmt, ...)
85 {
86 va_list va;
87 va_start(va, fmt);
88 fprintf(stderr, "warning: %d: ", line_number);
89 vfprintf(stderr, fmt, va);
90 fprintf(stderr, "\n");
91 va_end(va);
92 return 0;
93 }

  ViewVC Help
Powered by ViewVC 1.1.0 with CvsGraph 1.7.0