Update of /cvsroot/pure-data/pd/src In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv26559
Modified Files: Tag: desiredata s_loader.c Log Message: removed some MAXPDSTRING
Index: s_loader.c =================================================================== RCS file: /cvsroot/pure-data/pd/src/s_loader.c,v retrieving revision 1.4.4.5.2.10.2.8 retrieving revision 1.4.4.5.2.10.2.9 diff -C2 -d -r1.4.4.5.2.10.2.8 -r1.4.4.5.2.10.2.9 *** s_loader.c 19 Jul 2007 21:08:45 -0000 1.4.4.5.2.10.2.8 --- s_loader.c 19 Jul 2007 22:59:07 -0000 1.4.4.5.2.10.2.9 *************** *** 104,108 ****
static int sys_do_load_lib(t_canvas *canvas, char *objectname) { ! char filename[MAXPDSTRING], *dirbuf, *classname, *nameptr; t_xxx makeout = NULL; int fd; --- 104,108 ----
static int sys_do_load_lib(t_canvas *canvas, char *objectname) { ! char *filename=0, *dirbuf, *classname, *nameptr; t_xxx makeout = NULL; int fd; *************** *** 119,127 **** if ((fd = canvas_open2(canvas, objectname, sys_dllextent2, &dirbuf, &nameptr, 1)) >= 0) goto gotone; /* next try (objectname)/(classname).(sys_dllextent) ... */ ! strncpy(filename, objectname, MAXPDSTRING); ! filename[MAXPDSTRING-2] = 0; ! strcat(filename, "/"); ! strncat(filename, classname, MAXPDSTRING-strlen(filename)); ! filename[MAXPDSTRING-1] = 0; if ((fd = canvas_open2(canvas, filename, sys_dllextent , &dirbuf, &nameptr, 1)) >= 0) goto gotone; if ((fd = canvas_open2(canvas, filename, sys_dllextent2, &dirbuf, &nameptr, 1)) >= 0) goto gotone; --- 119,123 ---- if ((fd = canvas_open2(canvas, objectname, sys_dllextent2, &dirbuf, &nameptr, 1)) >= 0) goto gotone; /* next try (objectname)/(classname).(sys_dllextent) ... */ ! asprintf(&filename,"%s/%s",objectname,classname); if ((fd = canvas_open2(canvas, filename, sys_dllextent , &dirbuf, &nameptr, 1)) >= 0) goto gotone; if ((fd = canvas_open2(canvas, filename, sys_dllextent2, &dirbuf, &nameptr, 1)) >= 0) goto gotone; *************** *** 131,146 **** class_set_extern_dir(gensym(dirbuf)); /* rebuild the absolute pathname */ ! strncpy(filename, dirbuf, MAXPDSTRING); ! filename[MAXPDSTRING-2] = 0; ! strcat(filename, "/"); ! strncat(filename, nameptr, MAXPDSTRING-strlen(filename)); ! filename[MAXPDSTRING-1] = 0; #ifdef DL_OPEN void *dlobj = dlopen(filename, RTLD_NOW | RTLD_GLOBAL); if (!dlobj) { post("%s: %s", filename, dlerror()); ! class_set_extern_dir(&s_); ! free(symname); free(dirbuf); ! return 0; } makeout = (t_xxx)dlsym(dlobj, symname); --- 127,137 ---- class_set_extern_dir(gensym(dirbuf)); /* rebuild the absolute pathname */ ! free(filename); ! asprintf(&filename,"%s/%s",dirbuf,nameptr); #ifdef DL_OPEN void *dlobj = dlopen(filename, RTLD_NOW | RTLD_GLOBAL); if (!dlobj) { post("%s: %s", filename, dlerror()); ! goto forgetit; } makeout = (t_xxx)dlsym(dlobj, symname); *************** *** 151,157 **** if (!ntdll) { post("%s: couldn't load", filename); ! class_set_extern_dir(&s_); ! free(symname); free(dirbuf); ! return 0; } makeout = (t_xxx)GetProcAddress(ntdll); --- 142,146 ---- if (!ntdll) { post("%s: couldn't load", filename); ! goto forgetit; } makeout = (t_xxx)GetProcAddress(ntdll); *************** *** 159,171 **** if (!makeout) { post("%s: can't find symbol '%s' in library", filename, symname); ! class_set_extern_dir(&s_); ! free(symname); free(dirbuf); ! return 0; } makeout(); class_set_extern_dir(&s_); sys_putonloadlist(objectname); ! free(symname); return 1; }
--- 148,162 ---- if (!makeout) { post("%s: can't find symbol '%s' in library", filename, symname); ! goto forgetit; } makeout(); class_set_extern_dir(&s_); sys_putonloadlist(objectname); ! free(filename); free(symname); return 1; + forgetit: + class_set_extern_dir(&s_); + free(filename); free(symname); free(dirbuf); + return 0; }