Changeset 67
- Timestamp:
- Jan 9, 2011, 8:21:36 PM (14 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/zoo-kernel/service_internal_python.c
r63 r67 63 63 sprintf(pythonpath,"%s:%s",ntmp,python_path); 64 64 #endif 65 //#ifdef DEBUG65 #ifdef DEBUG 66 66 fprintf(stderr,"PYTHONPATH=%s\n",pythonpath); 67 //#endif67 #endif 68 68 #ifndef WIN32 69 69 setenv("PYTHONPATH",pythonpath,1); … … 222 222 if(PyDict_SetItem(res,name,value)<0){ 223 223 fprintf(stderr,"Unable to parse params..."); 224 Py_DECREF(value); 224 225 exit(1); 225 226 } … … 230 231 if(PyDict_SetItem(res,name,value)<0){ 231 232 fprintf(stderr,"Unable to parse params..."); 233 Py_DECREF(value); 232 234 exit(1); 233 235 } … … 239 241 if(PyDict_SetItem(res,name,value)<0){ 240 242 fprintf(stderr,"Unable to parse params..."); 243 Py_DECREF(value); 241 244 exit(1); 242 245 } … … 279 282 free(cursor->content); 280 283 free(cursor); 284 Py_DECREF(value); 285 Py_DECREF(key); 281 286 #ifdef DEBUG 282 287 dumpMaps(res); … … 293 298 int nb=PyList_Size(list); 294 299 int i; 300 int sizeValue=-1; 301 for(i=0;i<nb;i++){ 302 PyObject* key=PyList_GetItem(list,i); 303 if(strcmp(PyString_AsString(key),"size")==0){ 304 PyObject* value=PyDict_GetItem((PyObject*)t,key); 305 sizeValue=atoi(PyString_AsString(value)); 306 Py_DECREF(value); 307 Py_DECREF(key); 308 break; 309 } 310 Py_DECREF(key); 311 } 295 312 for(i=0;i<nb;i++){ 296 313 PyObject* key=PyList_GetItem(list,i); … … 300 317 PyString_AsString(key),PyString_AsString(value)); 301 318 #endif 302 if(res!=NULL) 303 addToMap(res,PyString_AsString(key),PyString_AsString(value)); 304 else 305 res=createMap(PyString_AsString(key),PyString_AsString(value)); 306 } 319 if(sizeValue>=0 && strcmp(PyString_AsString(key),"value")==0){ 320 char *buffer=NULL;//(char*)malloc((sizeValue+1)*sizeof(char)); 321 Py_ssize_t size; 322 PyString_AsStringAndSize(value,&buffer,&size); 323 if(res!=NULL){ 324 addToMap(res,PyString_AsString(key),""); 325 }else{ 326 res=createMap(PyString_AsString(key),""); 327 } 328 map* tmpR=getMap(res,"value"); 329 free(tmpR->value); 330 tmpR->value=(char*)malloc((sizeValue+1)*sizeof(char)); 331 memmove(tmpR->value,buffer,sizeValue*sizeof(char)); 332 tmpR->value[sizeValue]=0; 333 }else{ 334 if(res!=NULL) 335 addToMap(res,PyString_AsString(key),PyString_AsString(value)); 336 else 337 res=createMap(PyString_AsString(key),PyString_AsString(value)); 338 } 339 Py_DECREF(value); 340 Py_DECREF(key); 341 } 342 Py_DECREF(list); 307 343 return res; 308 344 }
Note: See TracChangeset
for help on using the changeset viewer.