Skip to content

Commit

Permalink
fix const warnings in dsh
Browse files Browse the repository at this point in the history
  • Loading branch information
adammoody committed Jan 25, 2019
1 parent 28586f1 commit 2f5571a
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions experimental/dsh/dsh.c
Expand Up @@ -591,7 +591,7 @@ static void sort_scan_sort(mfu_path* origpath, uint64_t allmax,
/* copy items into buffer */ /* copy items into buffer */
uint64_t idx = 0; uint64_t idx = 0;
char* ptr = (char*) buf; char* ptr = (char*) buf;
strmap_node* elem; const strmap_node* elem;
for (elem = strmap_node_first(children); for (elem = strmap_node_first(children);
elem != NULL; elem != NULL;
elem = strmap_node_next(elem)) elem = strmap_node_next(elem))
Expand Down Expand Up @@ -865,7 +865,7 @@ static void summarize_children(mfu_flist flist, mfu_path* path, int print_defaul
} }


/* free data structure allocated for each child */ /* free data structure allocated for each child */
strmap_node* elem; const strmap_node* elem;
for (elem = strmap_node_first(children); for (elem = strmap_node_first(children);
elem != NULL; elem != NULL;
elem = strmap_node_next(elem)) elem = strmap_node_next(elem))
Expand Down Expand Up @@ -1657,7 +1657,7 @@ static char* arg_to_regex(const char* arg)
{ {
/* count number of bytes we need */ /* count number of bytes we need */
size_t count = 2; /* for ^ and $ at ends of regex */ size_t count = 2; /* for ^ and $ at ends of regex */
char* str = arg; char* str = (char*)arg;
char* tok = strchr(str, '*'); char* tok = strchr(str, '*');
while (tok != NULL) { while (tok != NULL) {
count += tok - str; /* copy text leading up to * */ count += tok - str; /* copy text leading up to * */
Expand All @@ -1675,7 +1675,7 @@ static char* arg_to_regex(const char* arg)
strcpy(regex, "^"); strcpy(regex, "^");


/* replace each * with .* */ /* replace each * with .* */
str = arg; str = (char*)arg;
tok = strchr(str, '*'); tok = strchr(str, '*');
while (tok != NULL) { while (tok != NULL) {
strncat(regex, str, tok - str); strncat(regex, str, tok - str);
Expand Down Expand Up @@ -1815,7 +1815,7 @@ int main(int argc, char** argv)
paths = (mfu_param_path*) MFU_MALLOC((size_t)numpaths * sizeof(mfu_param_path)); paths = (mfu_param_path*) MFU_MALLOC((size_t)numpaths * sizeof(mfu_param_path));


/* process each path */ /* process each path */
char** argpaths = &argv[optind]; const char** argpaths = (const char**)(&argv[optind]);
mfu_param_path_set_all(numpaths, argpaths, paths); mfu_param_path_set_all(numpaths, argpaths, paths);


/* advance to next set of options */ /* advance to next set of options */
Expand Down

0 comments on commit 2f5571a

Please sign in to comment.