Remove the unused al_string API
This commit is contained in:
parent
7b3a2085aa
commit
245b7ff0b4
@ -54,7 +54,6 @@
|
||||
#include "cpu_caps.h"
|
||||
#include "compat.h"
|
||||
#include "threads.h"
|
||||
#include "alstring.h"
|
||||
#include "almalloc.h"
|
||||
|
||||
#include "backends/base.h"
|
||||
|
@ -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 */
|
@ -48,7 +48,6 @@
|
||||
#include "alu.h"
|
||||
#include "ringbuffer.h"
|
||||
#include "compat.h"
|
||||
#include "alstring.h"
|
||||
#include "converter.h"
|
||||
|
||||
#include "backends/base.h"
|
||||
|
@ -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;
|
||||
}
|
||||
}
|
||||
|
@ -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);
|
||||
|
@ -868,7 +868,6 @@ SET(ALC_OBJS
|
||||
Alc/filters/splitter.cpp
|
||||
Alc/filters/splitter.h
|
||||
Alc/helpers.cpp
|
||||
Alc/alstring.h
|
||||
Alc/compat.h
|
||||
Alc/cpu_caps.h
|
||||
Alc/fpu_modes.h
|
||||
|
@ -27,7 +27,6 @@
|
||||
#include "align.h"
|
||||
#include "atomic.h"
|
||||
#include "vector.h"
|
||||
#include "alstring.h"
|
||||
#include "almalloc.h"
|
||||
#include "threads.h"
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user