summaryrefslogtreecommitdiff
path: root/libgphoto2/gphoto2-setting.c
diff options
context:
space:
mode:
authorMarcus Meissner <marcus@jet.franken.de>2014-07-22 21:00:32 +0000
committerMarcus Meissner <marcus@jet.franken.de>2014-07-22 21:00:32 +0000
commitb06e5d1216b775d0f6cdee97d82d30fcd46912e9 (patch)
tree0d2191886a72f7c23016c52efddc1b556fae0c04 /libgphoto2/gphoto2-setting.c
parent6c5db352a61dff5506e154d0bfbf82a8b7542d0e (diff)
downloadlibgphoto2-b06e5d1216b775d0f6cdee97d82d30fcd46912e9.tar.gz
From: Axel Waggershauser <awagger@web.de>
1) introduce C_PARAMS and C_PARAMS_MSG along the lines of C_MEM 2) replace CHECK_NULL with C_PARAMS 3) replace the pattern if ( something ) return GP_ERROR_BAD_PARAMETERS; with C_PARAMS ( !something ); I went over the whole patch again to check that each 'something' condition is really inverted, so I dare to suggest you don't have to do that again ;). 4) replaced CHECK_LIST and CHECK_INDEX_RANGE with simple one-line C_PARAMS(...) expressions 5) a couple of hunks look like this - if (!inet_aton (buffer, &inp)) { - fprintf(stderr,"failed to scan for addr in %s\n", buffer); - return GP_ERROR_BAD_PARAMETERS; - } + C_PARAMS_MSG (inet_aton (buffer, &inp), so some 'lost' error messages get now properly piped into the gp_log mechanism. git-svn-id: https://svn.code.sf.net/p/gphoto/code/trunk/libgphoto2@15103 67ed7778-7388-44ab-90cf-0a291f65f57c
Diffstat (limited to 'libgphoto2/gphoto2-setting.c')
-rw-r--r--libgphoto2/gphoto2-setting.c5
1 files changed, 2 insertions, 3 deletions
diff --git a/libgphoto2/gphoto2-setting.c b/libgphoto2/gphoto2-setting.c
index d60c2d7d1..d2e815e92 100644
--- a/libgphoto2/gphoto2-setting.c
+++ b/libgphoto2/gphoto2-setting.c
@@ -51,7 +51,6 @@ static Setting glob_setting[512];
static int save_settings (void);
-#define CHECK_NULL(r) {if (!(r)) return (GP_ERROR_BAD_PARAMETERS);}
#define CHECK_RESULT(result) {int r = (result); if (r < 0) return (r);}
static int load_settings (void);
@@ -71,7 +70,7 @@ gp_setting_get (char *id, char *key, char *value)
{
int x;
- CHECK_NULL (id && key);
+ C_PARAMS (id && key);
if (!glob_setting_count)
load_settings ();
@@ -103,7 +102,7 @@ gp_setting_set (char *id, char *key, char *value)
{
int x;
- CHECK_NULL (id && key);
+ C_PARAMS (id && key);
if (!glob_setting_count)
load_settings ();