/[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.1 - (show annotations)
Tue Feb 20 12:07:03 2001 UTC (16 years, 7 months ago) by bertho
Branch: MAIN
Branch point for: CvsGraph
File MIME type: text/plain
Initial revision
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 }

  ViewVC Help
Powered by ViewVC 1.1.0 with CvsGraph 1.7.0