diff options
author | Pavel Grunt <pgrunt@redhat.com> | 2016-03-17 11:19:34 +0100 |
---|---|---|
committer | Pavel Grunt <pgrunt@redhat.com> | 2016-03-18 11:42:25 +0100 |
commit | 23cd3e6041fa686fbd3ac0bbee2e440eeceac822 (patch) | |
tree | 287e3ed16b105e135698648577dfbab3c7191ef3 /src/spice-uri.c | |
parent | c2e48b7c31163385cab40c7f728b69f563da8154 (diff) | |
download | spice-gtk-23cd3e6041fa686fbd3ac0bbee2e440eeceac822.tar.gz spice-gtk-23cd3e6041fa686fbd3ac0bbee2e440eeceac822.tar.xz spice-gtk-23cd3e6041fa686fbd3ac0bbee2e440eeceac822.zip |
Move strtok_r from glib-compat to spice-uri
It is not glib specific and it is only used in spice-uri
Acked-by: Victor Toso <victortoso@redhat.com>
Diffstat (limited to 'src/spice-uri.c')
-rw-r--r-- | src/spice-uri.c | 29 |
1 files changed, 29 insertions, 0 deletions
diff --git a/src/spice-uri.c b/src/spice-uri.c index e2c5c9a..d925973 100644 --- a/src/spice-uri.c +++ b/src/spice-uri.c @@ -60,6 +60,35 @@ enum { SPICE_URI_PORT }; +#ifndef HAVE_STRTOK_R +static char *strtok_r(char *s, const char *delim, char **save_ptr) +{ + char *token; + + if (s == NULL) + s = *save_ptr; + + /* Scan leading delimiters. */ + s += strspn (s, delim); + if (*s == '\0') + return NULL; + + /* Find the end of the token. */ + token = s; + s = strpbrk (token, delim); + if (s == NULL) + /* This token finishes the string. */ + *save_ptr = strchr (token, '\0'); + else + { + /* Terminate the token and make *SAVE_PTR point past it. */ + *s = '\0'; + *save_ptr = s + 1; + } + return token; +} +#endif + G_GNUC_INTERNAL SpiceURI* spice_uri_new(void) { |