Browse Source

MT#55283 rename all `str` to `s`

Variables named `str` shadow the global `typedef str`. Rename them to
just `s`.

Change-Id: Ia15eb560704304d6f66dbbe22be72a559e18186b
pull/1675/head
Richard Fuchs 3 years ago
parent
commit
95ec0939dd
9 changed files with 54 additions and 54 deletions
  1. +7
    -7
      daemon/bencode.c
  2. +10
    -10
      daemon/kernel.c
  3. +6
    -6
      daemon/main.c
  4. +7
    -7
      daemon/recording.c
  5. +3
    -3
      include/aux.h
  6. +10
    -10
      include/bencode.h
  7. +3
    -3
      recording-daemon/db.c
  8. +2
    -2
      recording-daemon/recaux.c
  9. +6
    -6
      recording-daemon/tag.c

+ 7
- 7
daemon/bencode.c View File

@ -269,16 +269,16 @@ bencode_item_t *bencode_integer(bencode_buffer_t *buf, long long int i) {
}
bencode_item_t *bencode_dictionary_add_len(bencode_item_t *dict, const char *key, size_t keylen, bencode_item_t *val) {
bencode_item_t *str;
bencode_item_t *s;
if (!dict || !val)
return NULL;
assert(dict->type == BENCODE_DICTIONARY);
str = bencode_string_len(dict->buffer, key, keylen);
if (!str)
s = bencode_string_len(dict->buffer, key, keylen);
if (!s)
return NULL;
__bencode_container_add(dict, str);
__bencode_container_add(dict, s);
__bencode_container_add(dict, val);
return val;
}
@ -423,9 +423,9 @@ static unsigned int __bencode_hash_str_len(const unsigned char *s, int len) {
return 0;
}
static unsigned int __bencode_hash_str(bencode_item_t *str) {
assert(str->type == BENCODE_STRING);
return __bencode_hash_str_len(str->iov[1].iov_base, str->iov[1].iov_len);
static unsigned int __bencode_hash_str(bencode_item_t *s) {
assert(s->type == BENCODE_STRING);
return __bencode_hash_str_len(s->iov[1].iov_base, s->iov[1].iov_len);
}
static void __bencode_hash_insert(bencode_item_t *key, struct __bencode_hash *hash) {


+ 10
- 10
daemon/kernel.c View File

@ -29,7 +29,7 @@ struct kernel_interface kernel;
static int kernel_action_table(const char *action, unsigned int id) {
char str[64];
char s[64];
int saved_errno;
int fd;
int i;
@ -38,10 +38,10 @@ static int kernel_action_table(const char *action, unsigned int id) {
fd = open(PREFIX "/control", O_WRONLY | O_TRUNC);
if (fd == -1)
return -1;
i = snprintf(str, sizeof(str), "%s %u\n", action, id);
if (i >= sizeof(str))
i = snprintf(s, sizeof(s), "%s %u\n", action, id);
if (i >= sizeof(s))
goto fail;
ret = write(fd, str, strlen(str));
ret = write(fd, s, strlen(s));
if (ret == -1)
goto fail;
close(fd);
@ -64,14 +64,14 @@ static int kernel_delete_table(unsigned int id) {
}
static int kernel_open_table(unsigned int id) {
char str[64];
char s[64];
int saved_errno;
int fd;
struct rtpengine_command_noop cmd;
ssize_t ret;
sprintf(str, PREFIX "/%u/control", id);
fd = open(str, O_RDWR | O_TRUNC);
sprintf(s, PREFIX "/%u/control", id);
fd = open(s, O_RDWR | O_TRUNC);
if (fd == -1)
return -1;
@ -193,7 +193,7 @@ int kernel_del_stream_stats(struct rtpengine_command_del_target_stats *cmd) {
}
GList *kernel_list() {
char str[64];
char s[64];
int fd;
struct rtpengine_list_entry *buf;
GList *li = NULL;
@ -202,8 +202,8 @@ GList *kernel_list() {
if (!kernel.is_open)
return NULL;
sprintf(str, PREFIX "/%u/blist", kernel.table);
fd = open(str, O_RDONLY);
sprintf(s, PREFIX "/%u/blist", kernel.table);
fd = open(s, O_RDONLY);
if (fd == -1)
return NULL;


+ 6
- 6
daemon/main.c View File

@ -352,20 +352,20 @@ static int if_addr_parse(GQueue *q, char *s, struct ifaddrs *ifas) {
static int redis_ep_parse(endpoint_t *ep, int *db, char **auth, const char *auth_env, char *str) {
static int redis_ep_parse(endpoint_t *ep, int *db, char **auth, const char *auth_env, char *s) {
char *sl;
long l;
sl = strrchr(str, '@');
sl = strrchr(s, '@');
if (sl) {
*sl = 0;
*auth = g_strdup(str);
str = sl+1;
*auth = g_strdup(s);
s = sl+1;
}
else if ((sl = getenv(auth_env)))
*auth = g_strdup(sl);
sl = strchr(str, '/');
sl = strchr(s, '/');
if (!sl)
return -1;
*sl = 0;
@ -378,7 +378,7 @@ static int redis_ep_parse(endpoint_t *ep, int *db, char **auth, const char *auth
if (l < 0)
return -1;
*db = l;
if (endpoint_parse_any_getaddrinfo_full(ep, str))
if (endpoint_parse_any_getaddrinfo_full(ep, s))
return -1;
return 0;
}


+ 7
- 7
daemon/recording.c View File

@ -489,7 +489,7 @@ static char *meta_setup_file(struct recording *recording) {
/**
* Write out a block of SDP to the metadata file.
*/
static void sdp_after_pcap(struct recording *recording, GString *str, struct call_monologue *ml,
static void sdp_after_pcap(struct recording *recording, GString *s, struct call_monologue *ml,
enum call_opmode opmode)
{
FILE *meta_fp = recording->u.pcap.meta_fp;
@ -509,7 +509,7 @@ static void sdp_after_pcap(struct recording *recording, GString *str, struct cal
fprintf(meta_fp, "%s", get_opmode_text(opmode));
fprintf(meta_fp, "\nSDP before RTP packet: %" PRIu64 "\n\n", recording->u.pcap.packet_num);
fflush(meta_fp);
if (write(meta_fd, str->str, str->len) <= 0)
if (write(meta_fd, s->str, s->len) <= 0)
ilog(LOG_WARN, "Error writing SDP body to metadata file: %s", strerror(errno));
}
@ -836,10 +836,10 @@ static void sdp_before_proc(struct recording *recording, const str *sdp, struct
"SDP from %u before %s", ml->unique_id, get_opmode_text(opmode));
}
static void sdp_after_proc(struct recording *recording, GString *str, struct call_monologue *ml,
static void sdp_after_proc(struct recording *recording, GString *s, struct call_monologue *ml,
enum call_opmode opmode)
{
append_meta_chunk(recording, str->str, str->len,
append_meta_chunk(recording, s->str, s->len,
"SDP from %u after %s", ml->unique_id, get_opmode_text(opmode));
}
@ -1011,11 +1011,11 @@ static void init_all(struct call *call) {
proc_init(call);
}
static void sdp_after_all(struct recording *recording, GString *str, struct call_monologue *ml,
static void sdp_after_all(struct recording *recording, GString *s, struct call_monologue *ml,
enum call_opmode opmode)
{
sdp_after_pcap(recording, str, ml, opmode);
sdp_after_proc(recording, str, ml, opmode);
sdp_after_pcap(recording, s, ml, opmode);
sdp_after_proc(recording, s, ml, opmode);
}
static void dump_packet_all(struct media_packet *mp, const str *s) {


+ 3
- 3
include/aux.h View File

@ -218,13 +218,13 @@ INLINE void strdupfree(char **d, const char *s) {
*d = strdup(s);
}
INLINE int strmemcmp(const void *mem, int len, const char *str) {
int l = strlen(str);
INLINE int strmemcmp(const void *mem, int len, const char *s) {
int l = strlen(s);
if (l < len)
return -1;
if (l > len)
return 1;
return memcmp(mem, str, len);
return memcmp(mem, s, len);
}
INLINE long unsigned int ssl_random(void) {


+ 10
- 10
include/bencode.h View File

@ -490,11 +490,11 @@ INLINE char *bencode_dictionary_get_string(bencode_item_t *dict, const char *key
return val->iov[1].iov_base;
}
INLINE char *bencode_dictionary_get_str(bencode_item_t *dict, const char *key, str *str) {
str->s = bencode_dictionary_get_string(dict, key, &str->len);
if (!str->s)
str->len = 0;
return str->s;
INLINE char *bencode_dictionary_get_str(bencode_item_t *dict, const char *key, str *s) {
s->s = bencode_dictionary_get_string(dict, key, &s->len);
if (!s->s)
s->len = 0;
return s->s;
}
INLINE char *bencode_dictionary_get_string_dup(bencode_item_t *dict, const char *key, size_t *len) {
@ -510,9 +510,9 @@ INLINE char *bencode_dictionary_get_string_dup(bencode_item_t *dict, const char
return ret;
}
INLINE char *bencode_dictionary_get_str_dup(bencode_item_t *dict, const char *key, str *str) {
str->s = bencode_dictionary_get_string_dup(dict, key, &str->len);
return str->s;
INLINE char *bencode_dictionary_get_str_dup(bencode_item_t *dict, const char *key, str *s) {
s->s = bencode_dictionary_get_string_dup(dict, key, &s->len);
return s->s;
}
INLINE long long int bencode_dictionary_get_integer(bencode_item_t *dict, const char *key, long long int defval) {
@ -585,12 +585,12 @@ INLINE int bencode_strcmp(bencode_item_t *a, const char *b) {
return 1;
return memcmp(a->iov[1].iov_base, b, len);
}
INLINE int bencode_dictionary_get_strcmp(bencode_item_t *dict, const char *key, const char *str) {
INLINE int bencode_dictionary_get_strcmp(bencode_item_t *dict, const char *key, const char *s) {
bencode_item_t *i;
i = bencode_dictionary_get(dict, key);
if (!i)
return 2;
return bencode_strcmp(i, str);
return bencode_strcmp(i, s);
}
INLINE str *bencode_get_str(bencode_item_t *in, str *out) {


+ 3
- 3
recording-daemon/db.c View File

@ -88,12 +88,12 @@ static void reset_conn(void) {
}
INLINE int prep(MYSQL_STMT **st, const char *str) {
INLINE int prep(MYSQL_STMT **st, const char *s) {
*st = mysql_stmt_init(mysql_conn);
if (!*st)
return -1;
if (mysql_stmt_prepare(*st, str, strlen(str))) {
ilog(LOG_ERR, "Failed to prepare statement '%s': %s", str, mysql_stmt_error(*st));
if (mysql_stmt_prepare(*st, s, strlen(s))) {
ilog(LOG_ERR, "Failed to prepare statement '%s': %s", s, mysql_stmt_error(*st));
return -1;
}
return 0;


+ 2
- 2
recording-daemon/recaux.c View File

@ -6,13 +6,13 @@
__thread int __sscanf_hack_var;
int __sscanf_match(const char *str, const char *fmt, ...) {
int __sscanf_match(const char *s, const char *fmt, ...) {
va_list ap;
__sscanf_hack_var = 0; // to make sure that sscanf consumes the entire string
va_start(ap, fmt);
int ret = vsscanf(str, fmt, ap);
int ret = vsscanf(s, fmt, ap);
va_end(ap);
if (__sscanf_hack_var == 0)


+ 6
- 6
recording-daemon/tag.c View File

@ -18,19 +18,19 @@ out:
return ret;
}
void tag_name(metafile_t *mf, unsigned long t, const char *str) {
void tag_name(metafile_t *mf, unsigned long t, const char *s) {
tag_t *tag = tag_get(mf, t);
tag->name = g_string_chunk_insert(mf->gsc, str);
tag->name = g_string_chunk_insert(mf->gsc, s);
}
void tag_label(metafile_t *mf, unsigned long t, const char *str) {
void tag_label(metafile_t *mf, unsigned long t, const char *s) {
tag_t *tag = tag_get(mf, t);
tag->label = g_string_chunk_insert(mf->gsc, str);
tag->label = g_string_chunk_insert(mf->gsc, s);
}
void tag_metadata(metafile_t *mf, unsigned long t, const char *str) {
void tag_metadata(metafile_t *mf, unsigned long t, const char *s) {
tag_t *tag = tag_get(mf, t);
tag->metadata = g_string_chunk_insert(mf->gsc, str);
tag->metadata = g_string_chunk_insert(mf->gsc, s);
}
void tag_free(tag_t *tag) {


Loading…
Cancel
Save