PostGIS
3.4.0dev-r@@SVN_REVISION@@
|
void option_list_parse | ( | char * | input, |
char ** | olist | ||
) |
option_list is a null-terminated list of strings, where every odd string is a key and every even string is a value.
To avoid lots of memory allocations, we use the input string as the backing store and fill in the olist with pointers to the start of the key and value strings, with keys in the even slots and values in the odd slots. The input needs to be writeable because we write a '\0' into the string at the break between token separators.
// array of char* char olist[OPTION_LIST_SIZE]; // zero out all the pointers so our list ends up null-terminated memset(olist, 0, sizeof(olist)); char input[OPTION_LIST_SIZE]; strcpy(input, "key1=value1 key2=value2"); // writeable option_list_parse(input, olist); char key = "key2"; const char* value = option_list_search(olist, key); printf("value of '%s' is '%s'\n", key, value);
Definition at line 86 of file optionlist.c.
References lwerror(), OPTION_LIST_SIZE, and option_list_string_to_lower().
Referenced by lwgeom_make_valid_params(), rt_pg_vsi_check_options(), rt_util_gdal_open(), and test_optionlist().