瀏覽代碼

use specific pointer for disabled library

ncannasse 7 年之前
父節點
當前提交
723318c9b6
共有 1 個文件被更改,包括 4 次插入2 次删除
  1. 4 2
      src/module.c

+ 4 - 2
src/module.c

@@ -220,6 +220,8 @@ static void append_type( char **p, hl_type *t ) {
 	}
 }
 
+#define DISABLED_LIB_PTR ((void*)(int_val)2)
+
 static void *resolve_library( const char *lib ) {
 	char tmp[256];	
 	void *h;
@@ -234,7 +236,7 @@ static void *resolve_library( const char *lib ) {
 	if( disPart ) {
 		disPart += strlen(lib);
 		if( *disPart == 0 || *disPart == ',' )
-			return NULL;
+			return DISABLED_LIB_PTR;
 	}
 #	endif
 
@@ -298,7 +300,7 @@ int hl_module_init( hl_module *m, void *stack_top_val ) {
 				curlib = n->lib;
 				libHandler = resolve_library(n->lib);
 			}
-			if( libHandler == NULL ) {
+			if( libHandler == DISABLED_LIB_PTR ) {
 				m->functions_ptrs[n->findex] = disabled_primitive;
 				continue;
 			}