Skip to content

Commit 042c3d8

Browse files
committed
error.[ch]: fix keyword usage
* use 'char *' for strings (w/o unsigned) * error.h: use extern for symbols located in error.o
1 parent 750abef commit 042c3d8

File tree

2 files changed

+21
-21
lines changed

2 files changed

+21
-21
lines changed

error.c

+8-8
Original file line numberDiff line numberDiff line change
@@ -69,8 +69,8 @@ struct alloc_header {
6969
int magic;
7070
int size;
7171
int line;
72-
unsigned char *file;
73-
unsigned char *comment;
72+
char *file;
73+
char *comment;
7474
};
7575
#endif
7676

@@ -141,7 +141,7 @@ void error(char *m, ...)
141141
#endif
142142

143143
int errline;
144-
unsigned char *errfile;
144+
char *errfile;
145145

146146
char errbuf[4096];
147147

@@ -166,7 +166,7 @@ void debug_msg(char *m, ...)
166166

167167
#ifdef LEAK_DEBUG
168168

169-
void *debug_mem_alloc(unsigned char *file, int line, size_t size)
169+
void *debug_mem_alloc(char *file, int line, size_t size)
170170
{
171171
void *p;
172172
#ifdef LEAK_DEBUG
@@ -197,7 +197,7 @@ void *debug_mem_alloc(unsigned char *file, int line, size_t size)
197197
return p;
198198
}
199199

200-
void *debug_mem_calloc(unsigned char *file, int line, size_t size)
200+
void *debug_mem_calloc(char *file, int line, size_t size)
201201
{
202202
void *p;
203203
#ifdef LEAK_DEBUG
@@ -227,7 +227,7 @@ void *debug_mem_calloc(unsigned char *file, int line, size_t size)
227227
return p;
228228
}
229229

230-
void debug_mem_free(unsigned char *file, int line, void *p)
230+
void debug_mem_free(char *file, int line, void *p)
231231
{
232232
#ifdef LEAK_DEBUG
233233
struct alloc_header *ah;
@@ -254,7 +254,7 @@ void debug_mem_free(unsigned char *file, int line, void *p)
254254
free(p);
255255
}
256256

257-
void *debug_mem_realloc(unsigned char *file, int line, void *p, size_t size)
257+
void *debug_mem_realloc(char *file, int line, void *p, size_t size)
258258
{
259259
#ifdef LEAK_DEBUG
260260
struct alloc_header *ah;
@@ -294,7 +294,7 @@ void *debug_mem_realloc(unsigned char *file, int line, void *p, size_t size)
294294
return (char *)p + L_D_S;
295295
}
296296

297-
void set_mem_comment(void *p, unsigned char *c, int l)
297+
void set_mem_comment(void *p, char *c, int l)
298298
{
299299
#ifdef LEAK_DEBUG_LIST
300300
struct alloc_header *ah = (struct alloc_header *)((char *)p - L_D_S);

error.h

+13-13
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ void error(char *, ...);
2424
void debug_msg(char *, ...);
2525
void int_error(char *, ...);
2626
extern int errline;
27-
extern unsigned char *errfile;
27+
extern char *errfile;
2828

2929
#ifdef HAVE_CALLOC
3030
#define x_calloc(x) calloc((x), 1)
@@ -43,11 +43,11 @@ static inline void *x_calloc(size_t x)
4343

4444
#ifdef LEAK_DEBUG
4545

46-
void *debug_mem_alloc(unsigned char *, int, size_t);
47-
void *debug_mem_calloc(unsigned char *, int, size_t);
48-
void debug_mem_free(unsigned char *, int, void *);
49-
void *debug_mem_realloc(unsigned char *, int, void *, size_t);
50-
void set_mem_comment(void *, unsigned char *, int);
46+
extern void *debug_mem_alloc(char *, int, size_t);
47+
extern void *debug_mem_calloc(char *, int, size_t);
48+
extern void debug_mem_free(char *, int, void *);
49+
extern void *debug_mem_realloc(char *, int, void *, size_t);
50+
extern void set_mem_comment(void *, char *, int);
5151

5252
#define mem_alloc(x) debug_mem_alloc(__FILE__, __LINE__, x)
5353
#define mem_calloc(x) debug_mem_calloc(__FILE__, __LINE__, x)
@@ -82,7 +82,7 @@ static inline void mem_free(void *p)
8282
{
8383
if (p == DUMMY) return;
8484
if (!p) {
85-
// internal((unsigned char *)"mem_free(NULL)");
85+
// internal("mem_free(NULL)");
8686
return;
8787
}
8888
free(p);
@@ -92,7 +92,7 @@ static inline void *mem_realloc(void *p, size_t size)
9292
{
9393
if (p == DUMMY) return mem_alloc(size);
9494
if (!p) {
95-
// internal((unsigned char *)"mem_realloc(NULL, %d)", size);
95+
// internal("mem_realloc(NULL, %d)", size);
9696
return NULL;
9797
}
9898
if (!size) {
@@ -106,11 +106,11 @@ static inline void *mem_realloc(void *p, size_t size)
106106
return p;
107107
}
108108

109-
static inline void *debug_mem_alloc(unsigned char *f, int l, size_t s) { f=f; l=l; return mem_alloc(s); }
110-
static inline void *debug_mem_calloc(unsigned char *f, int l, size_t s) { f=f; l=l; return mem_calloc(s); }
111-
static inline void debug_mem_free(unsigned char *f, int l, void *p) { f=f; l=l; mem_free(p); }
112-
static inline void *debug_mem_realloc(unsigned char *f, int l, void *p, size_t s) { f=f; l=l; return mem_realloc(p, s); }
113-
static inline void set_mem_comment(void *p, unsigned char *c, int l) {p=p; c=c; l=l;}
109+
static inline void *debug_mem_alloc(char *f, int l, size_t s) { f=f; l=l; return mem_alloc(s); }
110+
static inline void *debug_mem_calloc(char *f, int l, size_t s) { f=f; l=l; return mem_calloc(s); }
111+
static inline void debug_mem_free(char *f, int l, void *p) { f=f; l=l; mem_free(p); }
112+
static inline void *debug_mem_realloc(char *f, int l, void *p, size_t s) { f=f; l=l; return mem_realloc(p, s); }
113+
static inline void set_mem_comment(void *p, char *c, int l) {p=p; c=c; l=l;}
114114

115115
#endif
116116

0 commit comments

Comments
 (0)