/[jscoverage]/trunk/util.h
ViewVC logotype

Diff of /trunk/util.h

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 87 by siliconforks, Mon May 5 20:05:27 2008 UTC revision 191 by siliconforks, Tue Sep 23 03:49:29 2008 UTC
# Line 20  Line 20 
20  #ifndef UTIL_H_  #ifndef UTIL_H_
21  #define UTIL_H_  #define UTIL_H_
22    
23    #ifndef HAVE_VASPRINTF
24    #include <stdarg.h>
25    #endif
26    #include <stdbool.h>
27  #include <stdio.h>  #include <stdio.h>
28  #include <stdlib.h>  #include <stdlib.h>
29    
# Line 31  Line 35 
35    __attribute__((__noreturn__))    __attribute__((__noreturn__))
36    __attribute__((__format__(printf, 1, 2)));    __attribute__((__format__(printf, 1, 2)));
37    
38    void fatal_command_line(const char * format, ...)
39      __attribute__((__noreturn__))
40      __attribute__((__format__(printf, 1, 2)));
41    
42    size_t addst(size_t x, size_t y);
43    
44    size_t mulst(size_t x, size_t y);
45    
46  void * xmalloc(size_t size);  void * xmalloc(size_t size);
47    
48    #define xnew(type, count) ((type *) xmalloc(mulst((count), sizeof(type))))
49    
50  void * xrealloc(void * p, size_t size);  void * xrealloc(void * p, size_t size);
51    
52  char * xstrdup(const char * s);  char * xstrdup(const char * s);
53    
54    char * xstrndup(const char * s, size_t size);
55    
56    int xasprintf(char ** s, const char * template, ...) __attribute__((__format__(printf, 2, 3)));
57    
58  char * xgetcwd(void);  char * xgetcwd(void);
59    
60  FILE * xfopen(const char * file, const char * mode);  FILE * xfopen(const char * file, const char * mode);
# Line 51  Line 69 
69    
70  void mkdirs(const char * path);  void mkdirs(const char * path);
71    
72    bool str_starts_with(const char * string, const char * prefix);
73    
74    bool str_ends_with(const char * string, const char * suffix);
75    
76  char * make_path(const char * parent, const char * relative_path);  char * make_path(const char * parent, const char * relative_path);
77    
78  char * make_canonical_path(const char * relative_path);  char * make_canonical_path(const char * relative_path);
# Line 67  Line 89 
89    
90  void copy_file(const char * source_file, const char * destination_file);  void copy_file(const char * source_file, const char * destination_file);
91    
92  int directory_is_empty(const char * directory);  bool directory_is_empty(const char * directory);
93    
94  struct DirListEntry {  struct DirListEntry {
95    char * name;    char * name;
# Line 78  Line 100 
100    
101  void free_dir_list(struct DirListEntry * list);  void free_dir_list(struct DirListEntry * list);
102    
103    #ifndef HAVE_STRNDUP
104    char * strndup(const char * s, size_t size);
105    #endif
106    
107    #ifndef HAVE_VASPRINTF
108    int vasprintf(char ** s, const char * template, va_list a);
109    #endif
110    
111    #ifndef HAVE_ASPRINTF
112    int asprintf(char ** s, const char * template, ...) __attribute__((__format__(printf, 2, 3)));
113    #endif
114    
115  #endif  #endif

Legend:
Removed from v.87  
changed lines
  Added in v.191

  ViewVC Help
Powered by ViewVC 1.1.24