FS-4141 --resolve
This commit is contained in:
parent
50acea7d95
commit
5e5a2ff84b
|
@ -451,8 +451,6 @@ SWITCH_STANDARD_APP(hash_function)
|
||||||
value = strdup(argv[3]);
|
value = strdup(argv[3]);
|
||||||
switch_assert(value);
|
switch_assert(value);
|
||||||
switch_core_hash_insert(globals.db_hash, hash_key, value);
|
switch_core_hash_insert(globals.db_hash, hash_key, value);
|
||||||
} else {
|
|
||||||
switch_safe_free(value);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
} else if (!strcasecmp(argv[0], "delete")) {
|
} else if (!strcasecmp(argv[0], "delete")) {
|
||||||
|
@ -466,9 +464,9 @@ SWITCH_STANDARD_APP(hash_function)
|
||||||
}
|
}
|
||||||
if ((value = switch_core_hash_find(globals.db_hash, hash_key))) {
|
if ((value = switch_core_hash_find(globals.db_hash, hash_key))) {
|
||||||
if(!strcmp(argv[3], value)) {
|
if(!strcmp(argv[3], value)) {
|
||||||
|
switch_safe_free(value);
|
||||||
switch_core_hash_delete(globals.db_hash, hash_key);
|
switch_core_hash_delete(globals.db_hash, hash_key);
|
||||||
}
|
}
|
||||||
switch_safe_free(value);
|
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
goto usage;
|
goto usage;
|
||||||
|
@ -527,7 +525,6 @@ SWITCH_STANDARD_API(hash_api_function)
|
||||||
switch_thread_rwlock_wrlock(globals.db_hash_rwlock);
|
switch_thread_rwlock_wrlock(globals.db_hash_rwlock);
|
||||||
if ((value = switch_core_hash_find(globals.db_hash, hash_key))) {
|
if ((value = switch_core_hash_find(globals.db_hash, hash_key))) {
|
||||||
stream->write_function(stream, "-ERR key already exists\n");
|
stream->write_function(stream, "-ERR key already exists\n");
|
||||||
switch_safe_free(value);
|
|
||||||
} else {
|
} else {
|
||||||
value = strdup(argv[3]);
|
value = strdup(argv[3]);
|
||||||
switch_assert(value);
|
switch_assert(value);
|
||||||
|
@ -552,12 +549,12 @@ SWITCH_STANDARD_API(hash_api_function)
|
||||||
switch_thread_rwlock_wrlock(globals.db_hash_rwlock);
|
switch_thread_rwlock_wrlock(globals.db_hash_rwlock);
|
||||||
if ((value = switch_core_hash_find(globals.db_hash, hash_key))) {
|
if ((value = switch_core_hash_find(globals.db_hash, hash_key))) {
|
||||||
if(!strcmp(argv[3],value)) {
|
if(!strcmp(argv[3],value)) {
|
||||||
|
switch_safe_free(value);
|
||||||
switch_core_hash_delete(globals.db_hash, hash_key);
|
switch_core_hash_delete(globals.db_hash, hash_key);
|
||||||
stream->write_function(stream, "+OK\n");
|
stream->write_function(stream, "+OK\n");
|
||||||
} else {
|
} else {
|
||||||
stream->write_function(stream, "-ERR Doesn't match\n");
|
stream->write_function(stream, "-ERR Doesn't match\n");
|
||||||
}
|
}
|
||||||
switch_safe_free(value);
|
|
||||||
} else {
|
} else {
|
||||||
stream->write_function(stream, "-ERR Not found\n");
|
stream->write_function(stream, "-ERR Not found\n");
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue