Changeset 8
- Timestamp:
- 07/25/04 14:49:50 (9 years ago)
- Files:
-
- trunk/fastxsl.c (modified) (8 diffs)
- trunk/php_fastxsl.h (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
trunk/fastxsl.c
r7 r8 58 58 #define FASTXSL_SHARED_ALLOC 2 59 59 60 void fastxsl_errorfunc(void *ctx, const char *msg, ...); 61 60 62 static php_ss_wrapper * 61 63 SS_Wrapper_Alloc(int shared TSRMLS_DC) … … 380 382 381 383 wrapper = (php_ss_wrapper *) SS_Wrapper_Alloc(0 TSRMLS_CC); 382 wrapper->ss = xsltParseStylesheetFile( (const xmlChar *)filename);384 wrapper->ss = xsltParseStylesheetFile(filename); 383 385 if (!wrapper->ss) { 384 386 RETURN_FALSE; … … 547 549 } 548 550 551 wrapper = (php_ss_wrapper *) SS_Wrapper_Alloc(0 TSRMLS_CC); 549 552 result_wrapper->xd = xsltApplyStylesheet(ss_wrapper->ss, xd_wrapper->xd, 550 553 (const char **) parameters); … … 902 905 xmlFreeDoc(wrapper->xd); 903 906 free(wrapper); 907 } 908 909 void fastxsl_errorfunc(void *ctx, const char *msg, ...) 910 { 911 char *frag; 912 int fraglen; 913 int output = 0; 914 va_list args; 915 va_start(args, msg); 916 fraglen = vspprintf(&frag, 0, msg, args); 917 while(fraglen && frag[fraglen - 1] == '\n') { 918 frag[--fraglen] = '\0'; 919 output = 1; 920 } 921 if(fraglen) { 922 if(FASTXSL_G(errbuf)) { 923 FASTXSL_G(errbuf) = erealloc(FASTXSL_G(errbuf), fraglen + strlen(FASTXSL_G(errbuf))); 924 strcat(FASTXSL_G(errbuf), frag); 925 } else { 926 FASTXSL_G(errbuf) = frag; 927 } 928 } 929 va_end(args); 930 if(output) { 931 php_error_docref(NULL TSRMLS_CC, E_WARNING, FASTXSL_G(errbuf)); 932 efree(FASTXSL_G(errbuf)); 933 FASTXSL_G(errbuf) = NULL; 934 } 904 935 } 905 936 … … 1030 1061 fname = xmlXPathPopString(ctxt); 1031 1062 if(!fname) { 1032 xsltGeneric Debug(xsltGenericDebugContext,1063 xsltGenericError(xsltGenericDebugContext, 1033 1064 "passed function name is not a string"); 1034 1065 xmlXPathReturnEmptyString(ctxt); … … 1042 1073 if(call_user_function(EG(function_table), NULL, function, ret, 1043 1074 param_count, params TSRMLS_CC) == FAILURE) { 1044 xsltGeneric Debug(xsltGenericDebugContext,1075 xsltGenericError(xsltGenericDebugContext, 1045 1076 "function evaluation error"); 1046 1077 xmlXPathReturnEmptyString(ctxt); … … 1096 1127 1097 1128 ZEND_INIT_MODULE_GLOBALS(fastxsl, php_fastxsl_init_globals, php_fastxsl_destroy_globals); 1098 1129 1099 1130 REGISTER_INI_ENTRIES(); 1100 1131 … … 1111 1142 xmlRegisterOutputCallbacks(Stream_MatchWrapper, Stream_XmlWrite_OpenWrapper, 1112 1143 Stream_XmlWrite_WriteWrapper, Stream_CloseWrapper); 1113 1144 xsltSetGenericErrorFunc(NULL, fastxsl_errorfunc); 1145 xmlSetGenericErrorFunc(NULL, fastxsl_errorfunc); 1114 1146 #ifdef FASTXSL_MM 1115 1147 if (!sprintf(euid, "%d", geteuid())) { trunk/php_fastxsl.h
r7 r8 84 84 fl_cache *cache; 85 85 char *shmpath; 86 char *errbuf; 86 87 long nostat; 87 88 long register_functions;
