Changeset 5482:ba865ae62928 in roaraudio for libroar/keyval.c
- Timestamp:
- 04/25/12 09:46:25 (12 years ago)
- Branch:
- default
- Phase:
- public
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
libroar/keyval.c
r5381 r5482 65 65 } 66 66 67 static inline void skip_char(char * str) { 68 memmove(str, str+1, roar_mm_strlen(str)); 69 } 70 67 71 ssize_t roar_keyval_split (struct roar_keyval ** kv, char * str, const char * fdel, const char * kdel, int quotes) { 68 72 struct roar_keyval * kvs; … … 75 79 if ( kv == NULL || str == NULL ) { 76 80 roar_err_set(ROAR_ERROR_FAULT); 77 return -1;78 }79 80 // we currently do not support quotes81 if ( quotes ) {82 roar_err_set(ROAR_ERROR_NOTSUP);83 81 return -1; 84 82 } … … 95 93 if ( *sp == quote ) 96 94 quote = 0; 95 } else if ( quotes && (*sp == '\'' || *sp == '\"') ) { 96 quote = *sp; 97 97 } else { 98 98 if ( last_was_seg ) { … … 122 122 123 123 for (sp = str; *sp != 0; sp++) { 124 if ( quote ) { 125 if ( *sp == quote ) { 126 skip_char(sp); 127 quote = 0; 128 } else { 129 continue; 130 } 131 } else if ( quotes && (*sp == '\'' || *sp == '\"') ) { 132 quote = *sp; 133 skip_char(sp); 134 continue; 135 } 136 124 137 if ( last_was_seg ) { 125 138 if ( is_in(*sp, fdel) ) { … … 128 141 } else { 129 142 last_was_seg = 1; 130 if ( is_in(*sp, kdel) ) {143 if ( kvs[pos].value == NULL && is_in(*sp, kdel) ) { 131 144 *sp = 0; 132 145 kvs[pos].value = sp+1;
Note: See TracChangeset
for help on using the changeset viewer.