Changeset 957 for trunk/zoo-project
- Timestamp:
- Feb 6, 2020, 3:12:42 PM (5 years ago)
- Location:
- trunk/zoo-project/zoo-kernel
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/zoo-project/zoo-kernel/request_parser.c
r946 r957 416 416 while (pToken != NULL) 417 417 { 418 outputs_as_text[i] =418 /* outputs_as_text[i] = 419 419 (char *) malloc ((strlen (pToken) + 1) * sizeof (char)); 420 420 if (outputs_as_text[i] == NULL) … … 427 427 pToken); 428 428 pToken = strtok (NULL, ";"); 429 i++; 429 i++; */ 430 431 // knut : rewrite above fragment to enable parsing of mimetype;subtype strings in key-value pairs: 432 433 char* _token = zStrdup(pToken); 434 pToken = strtok (NULL, ";"); 435 436 if (pToken != NULL && strncmp(pToken, "subtype=", 8) == 0) 437 { 438 size_t _length = strlen(pToken) + strlen(_token) + 2; 439 outputs_as_text[i] = (char *) malloc(_length * sizeof (char)); 440 snprintf(outputs_as_text[i], _length, "%s;%s", _token, pToken); 441 pToken = strtok (NULL, ";"); 442 } 443 else 444 { 445 outputs_as_text[i] = (char *) malloc((strlen(_token) + 1) * sizeof (char)); 446 snprintf (outputs_as_text[i], strlen(_token) + 1, "%s", _token); 447 } 448 free(_token); 449 i++; 430 450 } 431 451 for (j = 0; j < i; j++) … … 862 882 for (l = 0; l < 3; l++){ 863 883 xmlChar *val = 864 xmlGetProp (cur4, BAD_CAST coms[l]); 884 //xmlGetProp (cur4, BAD_CAST coms[l]); 885 xmlGetProp (cur2, BAD_CAST coms[l]); // knut : get attributes from the Data xml element, not it's children (the content) 865 886 if (val != NULL && strlen ((char *) val) > 0){ 866 887 if (tmpmaps->content != NULL) -
trunk/zoo-project/zoo-kernel/service.c
r955 r957 1829 1829 #endif 1830 1830 #endif 1831 1832 /* 1833 * Dynamically allocate memory for a map value 1834 * 1835 * @param node the map for which the value buffer should be allocated 1836 * @param num_bytes the number of bytes to allocate 1837 * @return pointer to the allocated memory buffer 1838 * 1839 * This function will free, and hence delete, any existing value in the map. 1840 * The memory should be deallocated by calling freeMap. 1841 */ 1842 char* allocateMapValue(map* node, size_t num_bytes) 1843 { 1844 if (node == NULL) { 1845 return NULL; 1846 } 1847 1848 if (node->value != NULL) { 1849 free(node->value); 1850 } 1851 node->value = (char*) malloc(num_bytes); 1852 1853 return node->value; 1854 } -
trunk/zoo-project/zoo-kernel/service.h
r949 r957 481 481 #define zooLogMsg(file,message) logMessage(__FILE__, __func__, __LINE__, (file), (message)) 482 482 #define zooLog logMessage(__FILE__, __func__, __LINE__) 483 483 484 // knut : function for pre-allocated memory for a map value; 485 // processing algorithms may be able to write directly to this space, thereby avoiding unneccesary copying of data 486 ZOO_DLL_EXPORT char* allocateMapValue(map* node, size_t num_bytes); 487 484 488 #ifdef __cplusplus 485 489 }
Note: See TracChangeset
for help on using the changeset viewer.