mirror of
https://git.pwmt.org/pwmt/zathura.git
synced 2024-12-29 15:36:00 +01:00
Use g_strdup instead of malloc+strcpy
This commit is contained in:
parent
8bc9aa8af7
commit
93531c3eff
1 changed files with 3 additions and 9 deletions
|
@ -580,20 +580,14 @@ get_formatted_filename(zathura_t* zathura, const char* file_path, bool statusbar
|
||||||
tdir[tlen - 1] = '\0';
|
tdir[tlen - 1] = '\0';
|
||||||
return tdir;
|
return tdir;
|
||||||
} else {
|
} else {
|
||||||
char* path = g_try_malloc(sizeof(char) * strlen(file_path));
|
return g_strdup(file_path);
|
||||||
strncpy(path, file_path, file_path_len);
|
|
||||||
return path;
|
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
char* path = g_try_malloc(sizeof(char) * strlen(file_path));
|
return g_strdup(file_path);
|
||||||
strncpy(path, file_path, file_path_len);
|
|
||||||
return path;
|
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
const char* basename = zathura_document_get_basename(zathura->document);
|
const char* basename = zathura_document_get_basename(zathura->document);
|
||||||
char* basename_copy = g_try_malloc(sizeof(char) * strlen(basename));
|
return g_strdup(basename);
|
||||||
strncpy(basename_copy, basename, strlen(basename));
|
|
||||||
return basename_copy;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue