Skip to content

Commit

Permalink
[libzbase] fix build error/warning
Browse files Browse the repository at this point in the history
  • Loading branch information
gitgjogh committed Jan 16, 2017
1 parent a1dbfbb commit 263b62e
Show file tree
Hide file tree
Showing 5 changed files with 23 additions and 23 deletions.
2 changes: 1 addition & 1 deletion libzbase/zarray.c
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
*****************************************************************************/

#include <stdio.h>
#include <malloc.h>
#include <stdlib.h>
#include <string.h>

#include "zarray.h"
Expand Down
2 changes: 1 addition & 1 deletion libzbase/zhash.c
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ uint32_t zh_cstr_time33(uint32_t type, const char *key, uint32_t *key_len)
int c = 0;
uint32_t i = 0;
uint32_t hash = type;
for (i=0; c=key[i]; ++i) {
for (i=0; (c=key[i]); ++i) {
hash = hash * 33 + c;
}

Expand Down
36 changes: 18 additions & 18 deletions libzbase/zhtree.c
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ uint32_t zht_cstr_time33(uint32_t type, const char *key, uint32_t *key_len)
int c = 0;
uint32_t i = 0;
uint32_t hash = type * 33 + '/';
for (i=0; c=key[i]; ++i) {
for (i=0; (c=key[i]); ++i) {
hash = hash * 33 + c;
}

Expand Down Expand Up @@ -225,32 +225,32 @@ zht_node_t *zhtree_find_in_children(zhtree_t *h, zht_node_t *parent,
zht_node_t *node = 0;
zht_child_iter_t iter = zht_child_iter_init(parent);
WHILE_GET_ZHT_CHILD(iter, node)
{
{
if (node->hash==hash && node->parent==parent &&
node->key[key_len]==0 && strncmp(node->key, key, key_len)==0)
{
return node;
}
}
{
return node;
}
}
return 0;
}

static
zht_node_t *zhtree_find_in_collision(zhtree_t *h, zht_node_t *parent,
zh_hval_t hash, const char *key, uint32_t key_len)
{
{
zht_node_t *head = h->hash_tbl[GETLSBS(hash, h->depth_log2)];
zht_node_t *node = 0;
zh_link_iter_t iter = zh_link_iter_init((zh_node_t *)head);
WHILE_GET_COLLISION_NODE(iter, node)
{
{
if (node->hash==hash && node->parent==parent &&
node->key[key_len]==0 && strncmp(node->key, key, key_len)==0)
{
return node;
}
}
return 0;
{
return node;
}
}
return 0;
}

static
Expand All @@ -264,9 +264,9 @@ zaddr_t zhtree_touch_child_internal(zhtree_t *h, zht_node_t *parent,
/* we don't use @func zhtree_find_in_children()
because hash is thought to be faster */
zht_node_t *node = zhtree_find_in_collision(h, parent, hash, key, key_len);
if (node) {
h->ret_flag |= ZHASH_FOUND;
return node;
if (node) {
h->ret_flag |= ZHASH_FOUND;
return node;
}

if (b_insert)
Expand Down Expand Up @@ -363,7 +363,7 @@ zaddr_t zhtree_touch_node_internal(zhtree_t *h, const char *path,
parent = zhtree_get_wnode(h);
}

char *substr = 0;
char *substr = 0;
str_iter_t iter = str_iter_init(path, path_len);
WHILE_GET_FIELD(iter, "", "/", substr)
{
Expand Down Expand Up @@ -530,7 +530,7 @@ int zht_path_snprint(zht_path_t *iter, char *str, int size)
need += keylen; /* The space needed */
}
str[0] = 0;


return need;
}

Expand Down
4 changes: 2 additions & 2 deletions libzbase/zlist.c
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
*****************************************************************************/

#include <stdio.h>
#include <malloc.h>
#include <stdlib.h>
#include <string.h>

#include "zlist.h"
Expand Down Expand Up @@ -71,7 +71,7 @@ void zlist_buf_detach(zlist_t *zl)
{
SIM_FREEP(zl->qidx_2_bidx);
if (!zl->b_allocated) {
memset(zl, 0, sizeof(zl));
memset(zl, 0, sizeof(zlist_t));
}
}

Expand Down
2 changes: 1 addition & 1 deletion libzbase/zstrq.c
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,7 @@ zspace_t zstrq_get_buf_space(zstrq_t *sq)
static
zsq_char_t* zstrq_set_str_base(zstrq_t *sq, zqidx_t qidx, zsq_char_t *base)
{
sq->ptr_array[-qidx] = base;
return sq->ptr_array[-qidx] = base;
}

zsq_char_t* zstrq_get_str_base(zstrq_t *sq, zqidx_t qidx)
Expand Down

0 comments on commit 263b62e

Please sign in to comment.