gtk.cfg: Add g_error_*() functions (#1922)

This commit is contained in:
Sebastian 2019-06-25 19:19:10 +02:00 committed by GitHub
parent ba0ca5d087
commit d745dcc0eb
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 92 additions and 2 deletions

View File

@ -3928,9 +3928,80 @@
<leak-ignore/>
<noreturn>false</noreturn>
</function>
<function name="g_error_matches">
<leak-ignore/>
<!-- GError * g_error_copy(const GError *error); -->
<function name="g_error_copy">
<noreturn>false</noreturn>
<returnValue type="GError *"/>
<use-retval/>
<arg nr="1">
<not-uninit/>
</arg>
</function>
<!-- void g_error_free(GError *error); -->
<function name="g_error_free">
<noreturn>false</noreturn>
<returnValue type="void"/>
<arg nr="1">
<not-uninit/>
</arg>
</function>
<!-- gboolean g_error_matches(const GError *error, GQuark domain, gint code); -->
<function name="g_error_matches">
<noreturn>false</noreturn>
<returnValue type="gboolean"/>
<use-retval/>
<leak-ignore/>
<arg nr="1" direction="in">
<not-uninit/>
</arg>
<arg nr="2" direction="in">
<not-uninit/>
</arg>
<arg nr="3" direction="in">
<not-uninit/>
<not-bool/>
</arg>
</function>
<!-- GError * g_error_new(GQuark domain,
gint code,
const gchar *format,
...); -->
<function name="g_error_new">
<noreturn>false</noreturn>
<returnValue type="GError *"/>
<use-retval/>
<arg nr="1" direction="in">
<not-uninit/>
</arg>
<arg nr="2" direction="in">
<not-uninit/>
</arg>
<formatstr/>
<arg nr="3" direction="in">
<not-uninit/>
<not-null/>
<not-bool/>
<formatstr/>
</arg>
</function>
<!-- GError * g_error_new_literal(GQuark domain,
gint code,
const gchar *message); -->
<function name="g_error_new_literal">
<noreturn>false</noreturn>
<returnValue type="GError *"/>
<use-retval/>
<arg nr="1" direction="in">
<not-uninit/>
</arg>
<arg nr="2" direction="in">
<not-uninit/>
</arg>
<arg nr="3" direction="in">
<not-uninit/>
<not-null/>
<not-bool/>
</arg>
</function>
<!-- void g_free(gpointer mem); -->
<function name="g_free">

View File

@ -50,6 +50,9 @@ void validCode(int argInt)
gchar * pGchar1 = g_strconcat("a", "b", NULL);
printf("%s", pGchar1);
g_free(pGchar1);
GError * pGerror = g_error_new(1, -2, "a %d", 1);
g_error_free(pGerror);
}
void g_malloc_test()
@ -121,3 +124,19 @@ void g_try_new0_test()
printf("%p", pNew2);
// cppcheck-suppress memleak
}
void g_error_new_test()
{
// valid
GError * pNew1 = g_error_new(1, -2, "a %d", 1);
printf("%p", pNew1);
g_error_free(pNew1);
// cppcheck-suppress ignoredReturnValue
// cppcheck-suppress leakReturnValNotUsed
g_error_new(1, -2, "a %d", 1);
GError * pNew2 = g_error_new(1, -2, "a %d", 1);
printf("%p", pNew2);
// cppcheck-suppress memleak
}