diff options
author | Chris Robinson <[email protected]> | 2014-04-03 11:13:12 -0700 |
---|---|---|
committer | Chris Robinson <[email protected]> | 2014-04-03 11:13:12 -0700 |
commit | 482fb37b688b94f5aff78a8dc34e78c1e2840058 (patch) | |
tree | d32b2e32aa76df381019151b137f420dde3a1ffe /Alc/alstring.h | |
parent | 570eb4e1a7efb15a93a8b70e9293de6523b63284 (diff) |
Recognize NULL as an empty vector/string
Diffstat (limited to 'Alc/alstring.h')
-rw-r--r-- | Alc/alstring.h | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/Alc/alstring.h b/Alc/alstring.h index 8f7d1655..f9e16eb8 100644 --- a/Alc/alstring.h +++ b/Alc/alstring.h @@ -12,7 +12,7 @@ DECL_VECTOR(al_string_char_type) typedef vector_al_string_char_type al_string; typedef const_vector_al_string_char_type const_al_string; -#define AL_STRING_INIT(_x) do { (_x) = calloc(1, sizeof(*(_x)) + sizeof((_x)->Data[0])); } while(0) +#define AL_STRING_INIT(_x) VECTOR_INIT(_x) #define AL_STRING_DEINIT(_x) VECTOR_DEINIT(_x) inline ALsizei al_string_length(const_al_string str) @@ -22,7 +22,7 @@ inline ALsizei al_string_empty(const_al_string str) { return al_string_length(str) == 0; } inline const al_string_char_type *al_string_get_cstr(const_al_string str) -{ return &VECTOR_FRONT(str); } +{ return str ? &VECTOR_FRONT(str) : ""; } void al_string_clear(al_string *str); |