Merge branch 'master' of git.freeswitch.org:freeswitch

This commit is contained in:
Steve Underwood 2012-12-12 22:05:03 +08:00
commit 8f5c772d31
4 changed files with 46 additions and 4 deletions

View File

@ -40,7 +40,49 @@
#include <switch.h>
SWITCH_BEGIN_EXTERN_C SWITCH_DECLARE(int) switch_toupper(int c);
SWITCH_BEGIN_EXTERN_C
/* https://code.google.com/p/stringencoders/wiki/PerformanceAscii */
static inline uint32_t switch_toupper(uint32_t eax)
{
uint32_t ebx = (0x7f7f7f7ful & eax) + 0x05050505ul;
ebx = (0x7f7f7f7ful & ebx) + 0x1a1a1a1aul;
ebx = ((ebx & ~eax) >> 2 ) & 0x20202020ul;
return eax - ebx;
}
static inline void switch_toupper_max(char *s)
{
uint32_t *b,*p;
char *c;
size_t l;
int div = 0, rem = 0;
int i;
l = strlen(s);
div = l / 4;
rem = l % 4;
p = (uint32_t *) s;
for (i = 0; i < div; i++) {
b = p;
*b = (uint32_t) switch_toupper(*b);
b++;
p++;
}
c = (char *)p;
for (i = 0; i < rem; i++) {
*c = (char) switch_toupper(*c);
c++;
}
}
SWITCH_DECLARE(int) old_switch_toupper(int c);
SWITCH_DECLARE(int) switch_tolower(int c);
SWITCH_DECLARE(int) switch_isalnum(int c);
SWITCH_DECLARE(int) switch_isalpha(int c);

View File

@ -2217,7 +2217,7 @@ SWITCH_STANDARD_APP(fifo_track_call_function)
sql = switch_mprintf("update fifo_outbound set stop_time=0,start_time=%ld,outbound_fail_count=0,use_count=use_count+1,%s=%s+1,%s=%s+1 where uuid='%q'",
(long) switch_epoch_time_now(NULL), col1, col1, col2, col2, data);
fifo_execute_sql_queued(&sql, SWITCH_TRUE, SWITCH_TRUE);
fifo_execute_sql_queued(&sql, SWITCH_TRUE, SWITCH_FALSE);
if (switch_channel_direction(channel) == SWITCH_CALL_DIRECTION_INBOUND) {

View File

@ -766,13 +766,13 @@ SWITCH_DECLARE(switch_status_t) switch_event_del_header_val(switch_event_t *even
unsigned long hash = 0;
tp = event->headers;
hash = switch_ci_hashfunc_default(header_name, &hlen);
while (tp) {
hp = tp;
tp = tp->next;
x++;
switch_assert(x < 1000000);
hash = switch_ci_hashfunc_default(header_name, &hlen);
if ((!hp->hash || hash == hp->hash) && !strcasecmp(header_name, hp->name) && (zstr(val) || !strcmp(hp->value, val))) {
if (lp) {

View File

@ -2609,7 +2609,7 @@ const short _switch_C_toupper_[1 + SWITCH_CTYPE_NUM_CHARS] = {
const short *_switch_toupper_tab_ = _switch_C_toupper_;
SWITCH_DECLARE(int) switch_toupper(int c)
SWITCH_DECLARE(int) old_switch_toupper(int c)
{
if ((unsigned int) c > 255)
return (c);