Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
pwmt
zathura
Commits
93531c3e
Commit
93531c3e
authored
Oct 05, 2015
by
Sidharth Kapur
Browse files
Use g_strdup instead of malloc+strcpy
parent
8bc9aa8a
Changes
1
Hide whitespace changes
Inline
Side-by-side
zathura/zathura.c
View file @
93531c3e
...
...
@@ -580,20 +580,14 @@ get_formatted_filename(zathura_t* zathura, const char* file_path, bool statusbar
tdir
[
tlen
-
1
]
=
'\0'
;
return
tdir
;
}
else
{
char
*
path
=
g_try_malloc
(
sizeof
(
char
)
*
strlen
(
file_path
));
strncpy
(
path
,
file_path
,
file_path_len
);
return
path
;
return
g_strdup
(
file_path
);
}
}
else
{
char
*
path
=
g_try_malloc
(
sizeof
(
char
)
*
strlen
(
file_path
));
strncpy
(
path
,
file_path
,
file_path_len
);
return
path
;
return
g_strdup
(
file_path
);
}
}
else
{
const
char
*
basename
=
zathura_document_get_basename
(
zathura
->
document
);
char
*
basename_copy
=
g_try_malloc
(
sizeof
(
char
)
*
strlen
(
basename
));
strncpy
(
basename_copy
,
basename
,
strlen
(
basename
));
return
basename_copy
;
return
g_strdup
(
basename
);
}
}
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment