Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
pwmt
zathura
Commits
27f275dd
Commit
27f275dd
authored
Oct 21, 2011
by
Sebastian Ramacher
Browse files
use g_malloc0 for zathura_document_info_t
parent
9dd80678
Changes
1
Hide whitespace changes
Inline
Side-by-side
zathura.c
View file @
27f275dd
...
...
@@ -21,7 +21,7 @@ typedef struct zathura_document_info_s
const
char
*
password
;
}
zathura_document_info_t
;
gboolean
document_info_open
(
gpointer
data
);
static
gboolean
document_info_open
(
gpointer
data
);
/* function implementation */
zathura_t
*
...
...
@@ -54,9 +54,6 @@ zathura_init(int argc, char* argv[])
zathura_t
*
zathura
=
g_malloc0
(
sizeof
(
zathura_t
));
/* general */
zathura
->
document
=
NULL
;
/* plugins */
zathura
->
plugins
.
plugins
=
girara_list_new
();
girara_list_set_free_function
(
zathura
->
plugins
.
plugins
,
...
...
@@ -212,14 +209,12 @@ zathura_init(int argc, char* argv[])
/* open document if passed */
if
(
argc
>
1
)
{
zathura_document_info_t
*
document_info
=
malloc
(
sizeof
(
zathura_document_info_t
));
zathura_document_info_t
*
document_info
=
g_
malloc
0
(
sizeof
(
zathura_document_info_t
));
if
(
document_info
!=
NULL
)
{
document_info
->
zathura
=
zathura
;
document_info
->
path
=
argv
[
1
];
document_info
->
password
=
(
argc
>=
2
)
?
argv
[
2
]
:
NULL
;
g_idle_add
(
document_info_open
,
document_info
);
}
document_info
->
zathura
=
zathura
;
document_info
->
path
=
argv
[
1
];
document_info
->
password
=
(
argc
>=
2
)
?
argv
[
2
]
:
NULL
;
g_idle_add
(
document_info_open
,
document_info
);
}
return
zathura
;
...
...
@@ -277,20 +272,17 @@ zathura_free(zathura_t* zathura)
g_free
(
zathura
);
}
gboolean
static
gboolean
document_info_open
(
gpointer
data
)
{
zathura_document_info_t
*
document_info
=
data
;
g_return_val_if_fail
(
document_info
!=
NULL
,
FALSE
);
if
(
document_info
->
zathura
==
NULL
||
document_info
->
path
==
NULL
)
{
free
(
document_info
);
return
FALSE
;
if
(
document_info
->
zathura
!=
NULL
&&
document_info
->
path
!=
NULL
)
{
document_open
(
document_info
->
zathura
,
document_info
->
path
,
document_info
->
password
);
}
document_open
(
document_info
->
zathura
,
document_info
->
path
,
document_info
->
password
);
free
(
document_info
);
g_free
(
document_info
);
return
FALSE
;
}
...
...
Write
Preview
Markdown
is supported
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