diff options
author | Uwe Hermann <uwe@hermann-uwe.de> | 2015-03-07 19:12:15 +0100 |
---|---|---|
committer | Uwe Hermann <uwe@hermann-uwe.de> | 2015-04-01 00:25:51 +0200 |
commit | 077fa8acbcb8b585af6f5323f16221940a27a72e (patch) | |
tree | 564a091540e1d929e9e019a7f89658d1de55af2f /srd.c | |
parent | c052046717c09758bbdf62819e0029dddcae7159 (diff) | |
download | libsigrokdecode-077fa8acbcb8b585af6f5323f16221940a27a72e.tar.gz libsigrokdecode-077fa8acbcb8b585af6f5323f16221940a27a72e.zip |
Use g_malloc*() consistently, simplify error handling.
Use g_malloc*() for small allocations and assume they always
succeed. Simplify error handling in a few places accordingly.
Document the rules in the README file.
Diffstat (limited to 'srd.c')
-rw-r--r-- | srd.c | 5 |
1 files changed, 1 insertions, 4 deletions
@@ -248,10 +248,7 @@ SRD_PRIV int srd_decoder_searchpath_add(const char *path) /* Convert to wide chars. */ wc_len = sizeof(wchar_t) * (new_path->len + 1); - if (!(wc_new_path = g_try_malloc(wc_len))) { - srd_dbg("malloc failed"); - return SRD_ERR_MALLOC; - } + wc_new_path = g_malloc(wc_len); mbstowcs(wc_new_path, new_path->str, wc_len); PySys_SetPath(wc_new_path); g_string_free(new_path, TRUE); |