- Print out line number in a panic message using %d rather than %p. Line

numbers aren't pointers.
- Add a __printflike() attribute to libstand's panic() prototype to catch
  such bogons in the future.
This commit is contained in:
jhb 2004-01-15 18:35:32 +00:00
parent 77dbab5171
commit d8dbd69c9b
2 changed files with 2 additions and 2 deletions

View File

@ -369,7 +369,7 @@ extern int ischar(void);
extern void putchar(int); extern void putchar(int);
extern int devopen(struct open_file *, const char *, const char **); extern int devopen(struct open_file *, const char *, const char **);
extern int devclose(struct open_file *f); extern int devclose(struct open_file *f);
extern void panic(const char *, ...) __dead2; extern void panic(const char *, ...) __dead2 __printflike(1, 2);
extern struct fs_ops *file_system[]; extern struct fs_ops *file_system[];
extern struct devsw *devsw[]; extern struct devsw *devsw[];

View File

@ -109,7 +109,7 @@ Free(void *ptr, const char *file, int line)
return; return;
} }
if (res->ga_Magic != GAMAGIC) if (res->ga_Magic != GAMAGIC)
panic("free: guard1 fail @ %p from %s:%p", ptr, file, line); panic("free: guard1 fail @ %p from %s:%d", ptr, file, line);
res->ga_Magic = GAFREE; res->ga_Magic = GAFREE;
#endif #endif
#ifdef USEENDGUARD #ifdef USEENDGUARD