changeset 218:064ff6318dfc

merge changsets 8d9d717c9300 and a0a3196b1a05
author Thinker K.F. Li <thinker@branda.to>
date Sat, 13 Dec 2008 17:23:51 +0800
parents a0a3196b1a05 (diff) 8d9d717c9300 (current diff)
children 1eb9ee5ae4f2
files
diffstat 1 files changed, 5 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/tools/mb_c_source.m4	Sat Dec 13 17:13:31 2008 +0800
+++ b/tools/mb_c_source.m4	Sat Dec 13 17:23:51 2008 +0800
@@ -355,6 +355,9 @@
 
 #ifndef MB_LSYM_GET_OBJ_WITH_NAME
 #define MB_LSYM_GET_OBJ_WITH_NAME
+
+#define MB_SPRITE_OFF_2_PTR(x, off) (((void *)(x)) + (off))
+
 static
 mb_obj_t *mb_lsym_get_obj_with_name(mb_sprite_lsym_t *lsym, const char *sym) {
     int i;
@@ -362,7 +365,8 @@
     for(i = 0; i < lsym->num_entries; i++) {
 	if(strcmp(lsym->entries[i].sym, sym) != 0)
 	    continue;
-	return (mb_obj_t *)*((int*)(((void *)lsym) + lsym->entries[i].offset));
+	return *(mb_obj_t **)MB_SPRITE_OFF_2_PTR(lsym,
+					         lsym->entries[i].offset);
     }
     return NULL;
 }