Skip to content

Commit

Permalink
fix: apply antirez/sds#128
Browse files Browse the repository at this point in the history
Needed to silence the -Wshadow warnings
  • Loading branch information
dundargoc committed Nov 23, 2023
1 parent ab91b3f commit f320716
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions src/sds/sds.c
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ static inline char sdsReqType(size_t string_size) {
* end of the string. However the string is binary safe and can contain
* \0 characters in the middle, as the length is stored in the sds header. */
sds sdsnewlen(const void *init, size_t initlen) {
void *sh;
void *newsh;
sds s;
char type = sdsReqType(initlen);
/* Empty strings are usually created in order to append. Use type 8
Expand All @@ -96,13 +96,13 @@ sds sdsnewlen(const void *init, size_t initlen) {
int hdrlen = sdsHdrSize(type);
unsigned char *fp; /* flags pointer. */

sh = s_malloc(hdrlen+initlen+1);
if (sh == NULL) return NULL;
newsh = s_malloc(hdrlen+initlen+1);
if (newsh == NULL) return NULL;
if (init==SDS_NOINIT)
init = NULL;
else if (!init)
memset(sh, 0, hdrlen+initlen+1);
s = (char*)sh+hdrlen;
memset(newsh, 0, hdrlen+initlen+1);
s = (char*)newsh+hdrlen;
fp = ((unsigned char*)s)-1;
switch(type) {
case SDS_TYPE_5: {
Expand Down

0 comments on commit f320716

Please sign in to comment.