strlen() on constant string can be replaced by sizeof()-1

svn path=/trunk/netsurf/; revision=6333
This commit is contained in:
John Tytgat 2009-02-01 13:59:35 +00:00
parent 8e4853dd56
commit aa61544828
2 changed files with 2 additions and 2 deletions

View File

@ -1031,7 +1031,7 @@ gboolean nsbeos_openfile_open(beosWidget *widget, gpointer data)
current_model->top_level);
char *filename = beos_file_chooser_get_filename(
beos_FILE_CHOOSER(wndOpenFile));
char *url = malloc(strlen(filename) + strlen("file://") + 1);
char *url = malloc(strlen(filename) + sizeof("file://"));
sprintf(url, "file://%s", filename);

View File

@ -486,7 +486,7 @@ void nsgtk_openfile_open(char *filename)
{
struct browser_window *bw = nsgtk_get_browser_for_gui(
current_model->top_level);
char *url = malloc(strlen(filename) + strlen("file://") + 1);
char *url = malloc(strlen(filename) + sizeof("file://"));
sprintf(url, "file://%s", filename);