Navigation Menu

Skip to content

Commit

Permalink
Simplify StrDup().
Browse files Browse the repository at this point in the history
  • Loading branch information
icculus committed Feb 7, 2009
1 parent 85e84ce commit 6fee7f9
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 6 deletions.
4 changes: 1 addition & 3 deletions mojoshader.c
Expand Up @@ -262,9 +262,7 @@ static inline void *Malloc(Context *ctx, const size_t len)
static inline char *StrDup(Context *ctx, const char *str)
{
char *retval = (char *) Malloc(ctx, strlen(str) + 1);
if (retval == NULL)
out_of_memory(ctx);
else
if (retval != NULL)
strcpy(retval, str);
return retval;
} // StrDup
Expand Down
4 changes: 1 addition & 3 deletions mojoshader_assembler.c
Expand Up @@ -80,9 +80,7 @@ static inline void *Malloc(Context *ctx, const size_t len)
static inline char *StrDup(Context *ctx, const char *str)
{
char *retval = (char *) Malloc(ctx, strlen(str) + 1);
if (retval == NULL)
out_of_memory(ctx);
else
if (retval != NULL)
strcpy(retval, str);
return retval;
} // StrDup
Expand Down

0 comments on commit 6fee7f9

Please sign in to comment.