Skip to content

Commit

Permalink
spool.c:parseheader() - remove unnecessary checks for NULL
Browse files Browse the repository at this point in the history
The static function imap/spool.c:parseheader() is called from only one place.

The passed parameters headname, contents and rawvalue from that place are not
NULL, so there is no need to check within parseheader() if these parameters
are NULL.
  • Loading branch information
dilyanpalauzov committed Aug 13, 2023
1 parent ac50025 commit 1376c46
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions imap/spool.c
Original file line number Diff line number Diff line change
Expand Up @@ -291,9 +291,9 @@ static int parseheader(struct protstream *fin, FILE *fout,
if (c != EOF) prot_ungetc(c, fin);

/* and we didn't get a header */
if (headname != NULL) *headname = NULL;
if (contents != NULL) *contents = NULL;
if (rawvalue != NULL) *rawvalue = NULL;
*headname = NULL;
*contents = NULL;
*rawvalue = NULL;

return r;

Expand All @@ -303,9 +303,9 @@ static int parseheader(struct protstream *fin, FILE *fout,
/* Note: xstrdup()ing the string ensures we return
* a minimal length string with no allocation slack
* at the end */
if (headname != NULL) *headname = xstrdup(name.s);
if (contents != NULL) *contents = xstrdup(body.s);
if (rawvalue != NULL) *rawvalue = xstrdup(raw.s);
*headname = xstrdup(name.s);
*contents = xstrdup(body.s);
*rawvalue = xstrdup(raw.s);

return 0;
}
Expand Down

0 comments on commit 1376c46

Please sign in to comment.