diff options
author | Chris Robinson <[email protected]> | 2018-11-15 06:32:01 -0800 |
---|---|---|
committer | Chris Robinson <[email protected]> | 2018-11-15 06:32:01 -0800 |
commit | 245b7ff0b41ebd43f3c1c53dd90ab0bf358e4c06 (patch) | |
tree | a48dda544928194b84ae71e8789274f6025c7c3e /Alc | |
parent | 7b3a2085aac8eac47f9968f331d3991167793e85 (diff) |
Remove the unused al_string API
Diffstat (limited to 'Alc')
-rw-r--r-- | Alc/alc.cpp | 1 | ||||
-rw-r--r-- | Alc/alstring.h | 49 | ||||
-rw-r--r-- | Alc/backends/wasapi.cpp | 1 | ||||
-rw-r--r-- | Alc/helpers.cpp | 99 | ||||
-rw-r--r-- | Alc/inldefs.c | 7 |
5 files changed, 0 insertions, 157 deletions
diff --git a/Alc/alc.cpp b/Alc/alc.cpp index 159e3bc8..6c4e970e 100644 --- a/Alc/alc.cpp +++ b/Alc/alc.cpp @@ -54,7 +54,6 @@ #include "cpu_caps.h" #include "compat.h" #include "threads.h" -#include "alstring.h" #include "almalloc.h" #include "backends/base.h" diff --git a/Alc/alstring.h b/Alc/alstring.h deleted file mode 100644 index f991310f..00000000 --- a/Alc/alstring.h +++ /dev/null @@ -1,49 +0,0 @@ -#ifndef ALSTRING_H -#define ALSTRING_H - -#include <string.h> - -#include "vector.h" - - -#ifdef __cplusplus -extern "C" { -#endif - -typedef char al_string_char_type; -TYPEDEF_VECTOR(al_string_char_type, al_string) -TYPEDEF_VECTOR(al_string, vector_al_string) - -inline void alstr_reset(al_string *str) -{ VECTOR_DEINIT(*str); } -#define AL_STRING_INIT(_x) do { (_x) = (al_string)NULL; } while(0) -#define AL_STRING_INIT_STATIC() ((al_string)NULL) -#define AL_STRING_DEINIT(_x) alstr_reset(&(_x)) - -inline size_t alstr_length(const_al_string str) -{ return VECTOR_SIZE(str); } - -inline ALboolean alstr_empty(const_al_string str) -{ return alstr_length(str) == 0; } - -inline const al_string_char_type *alstr_get_cstr(const_al_string str) -{ return str ? &VECTOR_FRONT(str) : ""; } - -void alstr_clear(al_string *str); - -int alstr_cmp(const_al_string str1, const_al_string str2); -int alstr_cmp_cstr(const_al_string str1, const al_string_char_type *str2); - -void alstr_copy(al_string *str, const_al_string from); -void alstr_copy_cstr(al_string *str, const al_string_char_type *from); -void alstr_copy_range(al_string *str, const al_string_char_type *from, const al_string_char_type *to); - -void alstr_append_char(al_string *str, const al_string_char_type c); -void alstr_append_cstr(al_string *str, const al_string_char_type *from); -void alstr_append_range(al_string *str, const al_string_char_type *from, const al_string_char_type *to); - -#ifdef __cplusplus -} /* extern "C" */ -#endif - -#endif /* ALSTRING_H */ diff --git a/Alc/backends/wasapi.cpp b/Alc/backends/wasapi.cpp index 4fb0f317..b842b8ed 100644 --- a/Alc/backends/wasapi.cpp +++ b/Alc/backends/wasapi.cpp @@ -48,7 +48,6 @@ #include "alu.h" #include "ringbuffer.h" #include "compat.h" -#include "alstring.h" #include "converter.h" #include "backends/base.h" diff --git a/Alc/helpers.cpp b/Alc/helpers.cpp index 89f60380..d31101f7 100644 --- a/Alc/helpers.cpp +++ b/Alc/helpers.cpp @@ -120,7 +120,6 @@ DEFINE_PROPERTYKEY(PKEY_AudioEndpoint_GUID, 0x1da5d803, 0xd492, 0x4edd, 0x8c, 0x #include "fpu_modes.h" #include "uintmap.h" #include "vector.h" -#include "alstring.h" #include "compat.h" #include "threads.h" @@ -736,101 +735,3 @@ char *alstrdup(const char *str) memcpy(ret, str, len); return ret; } - - -void alstr_clear(al_string *str) -{ - if(!alstr_empty(*str)) - { - /* Reserve one more character than the total size of the string. This - * is to ensure we have space to add a null terminator in the string - * data so it can be used as a C-style string. - */ - VECTOR_RESIZE(*str, 0, 1); - VECTOR_ELEM(*str, 0) = 0; - } -} - -static inline int alstr_compare(const al_string_char_type *str1, size_t str1len, - const al_string_char_type *str2, size_t str2len) -{ - size_t complen = (str1len < str2len) ? str1len : str2len; - int ret = memcmp(str1, str2, complen); - if(ret == 0) - { - if(str1len > str2len) return 1; - if(str1len < str2len) return -1; - } - return ret; -} -int alstr_cmp(const_al_string str1, const_al_string str2) -{ - return alstr_compare(&VECTOR_FRONT(str1), alstr_length(str1), - &VECTOR_FRONT(str2), alstr_length(str2)); -} -int alstr_cmp_cstr(const_al_string str1, const al_string_char_type *str2) -{ - return alstr_compare(&VECTOR_FRONT(str1), alstr_length(str1), - str2, strlen(str2)); -} - -void alstr_copy(al_string *str, const_al_string from) -{ - size_t len = alstr_length(from); - VECTOR_RESIZE(*str, len, len+1); - for(size_t i{0};i < len;i++) - VECTOR_ELEM(*str, i) = VECTOR_ELEM(from, i); - VECTOR_ELEM(*str, len) = 0; -} - -void alstr_copy_cstr(al_string *str, const al_string_char_type *from) -{ - size_t len = strlen(from); - VECTOR_RESIZE(*str, len, len+1); - for(size_t i{0};i < len;i++) - VECTOR_ELEM(*str, i) = from[i]; - VECTOR_ELEM(*str, len) = 0; -} - -void alstr_copy_range(al_string *str, const al_string_char_type *from, const al_string_char_type *to) -{ - size_t len = to - from; - VECTOR_RESIZE(*str, len, len+1); - for(size_t i{0};i < len;i++) - VECTOR_ELEM(*str, i) = from[i]; - VECTOR_ELEM(*str, len) = 0; -} - -void alstr_append_char(al_string *str, const al_string_char_type c) -{ - size_t len = alstr_length(*str); - VECTOR_RESIZE(*str, len+1, len+2); - VECTOR_BACK(*str) = c; - VECTOR_ELEM(*str, len+1) = 0; -} - -void alstr_append_cstr(al_string *str, const al_string_char_type *from) -{ - size_t len = strlen(from); - if(len != 0) - { - size_t base = alstr_length(*str); - VECTOR_RESIZE(*str, base+len, base+len+1); - for(size_t i{0};i < len;i++) - VECTOR_ELEM(*str, base+i) = from[i]; - VECTOR_ELEM(*str, base+len) = 0; - } -} - -void alstr_append_range(al_string *str, const al_string_char_type *from, const al_string_char_type *to) -{ - size_t len = to - from; - if(len != 0) - { - size_t base = alstr_length(*str); - VECTOR_RESIZE(*str, base+len, base+len+1); - for(size_t i{0};i < len;i++) - VECTOR_ELEM(*str, base+i) = from[i]; - VECTOR_ELEM(*str, base+len) = 0; - } -} diff --git a/Alc/inldefs.c b/Alc/inldefs.c index 451c3bcc..dd1cff4a 100644 --- a/Alc/inldefs.c +++ b/Alc/inldefs.c @@ -7,7 +7,6 @@ #include "mixer/defs.h" #include "alBuffer.h" #include "alEffect.h" -#include "alstring.h" #include "backends/base.h" @@ -31,12 +30,6 @@ extern inline ALsizei FrameSizeFromUserFmt(enum UserFmtChannels chans, enum User extern inline ALsizei FrameSizeFromFmt(enum FmtChannels chans, enum FmtType type); -extern inline void alstr_reset(al_string *str); -extern inline size_t alstr_length(const_al_string str); -extern inline ALboolean alstr_empty(const_al_string str); -extern inline const al_string_char_type *alstr_get_cstr(const_al_string str); - - extern inline ALuint NextPowerOf2(ALuint value); extern inline size_t RoundUp(size_t value, size_t r); extern inline ALint fastf2i(ALfloat f); |