Skip to content

Commit

Permalink
Fixing strdup() compilation warning (not ISO C) #309
Browse files Browse the repository at this point in the history
  • Loading branch information
dvorka committed Aug 26, 2018
1 parent 1ebc0c1 commit d9f190c
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 3 deletions.
4 changes: 2 additions & 2 deletions src/hstr_history.c
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ char* get_history_file_name(void)
} else {
// allocate so that this function always returns string to be freed
// (getenv() returns pointer (no need to free), home is allocated (must be freed)
historyFile = strdup(historyFile);
historyFile = hstr_strdup(historyFile);
}
return historyFile;
}
Expand Down Expand Up @@ -155,7 +155,7 @@ HistoryItems* prioritized_history_create(int optionBigKeys, HashSet *blacklist)
if((r=hashset_get(&rankmap, line))==NULL) {
r=malloc(sizeof(RankedHistoryItem));
r->rank=history_ranking_function(0, i, strlen(line));
r->item=strdup(line);
r->item=hstr_strdup(line);

hashset_put(&rankmap, line, r);

Expand Down
1 change: 0 additions & 1 deletion src/include/hstr_history.h
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@

#include <fcntl.h>
#include <limits.h>
#include <string.h>
// do NOT remove stdio.h include - must be present on certain system before readline to compile
#include <stdio.h>
#include <readline/history.h>
Expand Down

0 comments on commit d9f190c

Please sign in to comment.