File tree Expand file tree Collapse file tree 1 file changed +12
-7
lines changed
Expand file tree Collapse file tree 1 file changed +12
-7
lines changed Original file line number Diff line number Diff line change @@ -581,13 +581,16 @@ xy_str_start_with (const char *str, const char *prefix)
581581static char *
582582xy_str_delete_prefix (const char * str , const char * prefix )
583583{
584- char * new = xy_strdup (str );
585584 bool yes = xy_str_start_with (str , prefix );
586- if (!yes ) return new ;
587- size_t len = strlen (prefix );
588- char * ret = xy_strdup (new + len );
589- free (new );
590- return ret ;
585+ if (!yes )
586+ {
587+ return xy_strdup (str );
588+ }
589+ else
590+ {
591+ size_t len = strlen (prefix );
592+ return xy_strdup (str + len );
593+ }
591594}
592595
593596/**
@@ -1224,7 +1227,9 @@ xy_dir_exist (const char *path)
12241227 }
12251228 else
12261229 {
1227- int status = system (xy_2strcat ("test -d " , dir ));
1230+ char * tmp_cmd = xy_2strcat ("test -d " , dir );
1231+ int status = system (tmp_cmd );
1232+ free (tmp_cmd );
12281233 bool result = (0 == status );
12291234 if (allocated_dir ) free (allocated_dir );
12301235 return result ;
You can’t perform that action at this time.
0 commit comments