GRUB_FILE implementation

This commit is contained in:
Vladimir 'phcoder' Serbinenko 2010-02-09 15:32:42 +01:00
parent 660960d697
commit 2d2a9cd5b6
9 changed files with 29 additions and 16 deletions

View file

@ -52,7 +52,7 @@ grub_bad_type_cast_real (int line, const char *file)
return 0;
}
#define grub_bad_type_cast() grub_bad_type_cast_real(__LINE__, __FILE__)
#define grub_bad_type_cast() grub_bad_type_cast_real(__LINE__, GRUB_FILE)
#define GRUB_FIELD_MATCH(ptr, type, field) \
((char *) &(ptr)->field == (char *) &((type) (ptr))->field)

View file

@ -46,7 +46,7 @@
#define ARRAY_SIZE(array) (sizeof (array) / sizeof (array[0]))
#define COMPILE_TIME_ASSERT(cond) switch (0) { case 1: case !(cond): ; }
#define grub_dprintf(condition, fmt, args...) grub_real_dprintf(__FILE__, __LINE__, condition, fmt, ## args)
#define grub_dprintf(condition, fmt, args...) grub_real_dprintf(GRUB_FILE, __LINE__, condition, fmt, ## args)
/* XXX: If grub_memmove is too slow, we must implement grub_memcpy. */
#define grub_memcpy(d,s,n) grub_memmove ((d), (s), (n))

View file

@ -44,19 +44,19 @@ void grub_mm_dump_free (void);
void grub_mm_dump (unsigned lineno);
#define grub_malloc(size) \
grub_debug_malloc (__FILE__, __LINE__, size)
grub_debug_malloc (GRUB_FILE, __LINE__, size)
#define grub_zalloc(size) \
grub_debug_zalloc (__FILE__, __LINE__, size)
grub_debug_zalloc (GRUB_FILE, __LINE__, size)
#define grub_realloc(ptr,size) \
grub_debug_realloc (__FILE__, __LINE__, ptr, size)
grub_debug_realloc (GRUB_FILE, __LINE__, ptr, size)
#define grub_memalign(align,size) \
grub_debug_memalign (__FILE__, __LINE__, align, size)
grub_debug_memalign (GRUB_FILE, __LINE__, align, size)
#define grub_free(ptr) \
grub_debug_free (__FILE__, __LINE__, ptr)
grub_debug_free (GRUB_FILE, __LINE__, ptr)
void *EXPORT_FUNC(grub_debug_malloc) (const char *file, int line,
grub_size_t size);

View file

@ -54,7 +54,7 @@ void grub_test_nonzero (int cond, const char *file,
/* Macro to fill in location details and an optional error message. */
#define grub_test_assert(cond, ...) \
grub_test_nonzero(cond, __FILE__, __FUNCTION__, __LINE__, \
grub_test_nonzero(cond, GRUB_FILE, __FUNCTION__, __LINE__, \
## __VA_ARGS__, \
"assert failed: %s", #cond)