Skip to content

Commit 00c8076

Browse files
author
Ciaran Anscomb
committed
Avoid warnings with -Wshadow
Simply renaming 'sh' to 'newsh' in sdsnewlen() avoids a shadowed variable warning when invoking SDS_HDR_VAR().
1 parent fb46314 commit 00c8076

1 file changed

Lines changed: 5 additions & 5 deletions

File tree

sds.c

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,7 @@ static inline char sdsReqType(size_t string_size) {
8787
* end of the string. However the string is binary safe and can contain
8888
* \0 characters in the middle, as the length is stored in the sds header. */
8989
sds sdsnewlen(const void *init, size_t initlen) {
90-
void *sh;
90+
void *newsh;
9191
sds s;
9292
char type = sdsReqType(initlen);
9393
/* Empty strings are usually created in order to append. Use type 8
@@ -96,13 +96,13 @@ sds sdsnewlen(const void *init, size_t initlen) {
9696
int hdrlen = sdsHdrSize(type);
9797
unsigned char *fp; /* flags pointer. */
9898

99-
sh = s_malloc(hdrlen+initlen+1);
100-
if (sh == NULL) return NULL;
99+
newsh = s_malloc(hdrlen+initlen+1);
100+
if (newsh == NULL) return NULL;
101101
if (init==SDS_NOINIT)
102102
init = NULL;
103103
else if (!init)
104-
memset(sh, 0, hdrlen+initlen+1);
105-
s = (char*)sh+hdrlen;
104+
memset(newsh, 0, hdrlen+initlen+1);
105+
s = (char*)newsh+hdrlen;
106106
fp = ((unsigned char*)s)-1;
107107
switch(type) {
108108
case SDS_TYPE_5: {

0 commit comments

Comments
 (0)