From: Uwe Hermann Date: Sat, 15 Jan 2011 14:43:25 +0000 (+0100) Subject: Cosmetics. X-Git-Tag: libsigrok-0.1.0~430 X-Git-Url: https://sigrok.org/gitaction?a=commitdiff_plain;h=484760d1a8a26ba830b3d63d1451dc30985babd1;p=libsigrok.git Cosmetics. --- diff --git a/backend.c b/backend.c index 9ce8c5b1..4edc7812 100644 --- a/backend.c +++ b/backend.c @@ -25,6 +25,7 @@ int sigrok_init(void) return load_hwplugins(); } +/* TODO: Should return int to be able to report back error codes. */ void sigrok_cleanup(void) { device_close_all(); diff --git a/datastore.c b/datastore.c index 9527ff00..4ca23a4c 100644 --- a/datastore.c +++ b/datastore.c @@ -49,7 +49,7 @@ int datastore_destroy(struct datastore *ds) if (!ds) return SIGROK_ERR; - + for (chunk = ds->chunklist; chunk; chunk = chunk->next) g_free(chunk->data); g_slist_free(ds->chunklist); diff --git a/hwplugin.c b/hwplugin.c index 1ba4dbb0..0a30aad0 100644 --- a/hwplugin.c +++ b/hwplugin.c @@ -62,7 +62,6 @@ extern struct device_plugin asix_sigma_plugin_info; extern struct device_plugin link_mso19_plugin_info; #endif - /* TODO: No linked list needed, this can be a simple array. */ int load_hwplugins(void) { diff --git a/output/common.c b/output/common.c index 39eb9a02..c10d4d2b 100644 --- a/output/common.c +++ b/output/common.c @@ -38,7 +38,7 @@ char *sigrok_samplerate_string(uint64_t samplerate) int r; o = malloc(30 + 1); /* Enough for a uint64_t as string + " GHz". */ - if (o == NULL) + if (!o) return NULL; if (samplerate >= GHZ(1)) @@ -59,7 +59,6 @@ char *sigrok_samplerate_string(uint64_t samplerate) return o; } - /** * Convert a numeric samplerate value to the "natural" string representation * of its period. @@ -76,7 +75,7 @@ char *sigrok_period_string(uint64_t frequency) int r; o = malloc(30 + 1); /* Enough for a uint64_t as string + " ms". */ - if (o == NULL) + if (!o) return NULL; if (frequency >= GHZ(1)) @@ -96,4 +95,3 @@ char *sigrok_period_string(uint64_t frequency) return o; } - diff --git a/sigrok.h b/sigrok.h index 26bf9fcc..2f31a34b 100644 --- a/sigrok.h +++ b/sigrok.h @@ -27,7 +27,6 @@ #include #include - /* * Status/error codes returned by libsigrok functions. * @@ -54,7 +53,6 @@ #define MAX_NUM_PROBES 64 #define MAX_PROBENAME_LEN 32 - /* Handy little macros */ #define KHZ(n) ((n) * 1000) #define MHZ(n) ((n) * 1000000) @@ -70,10 +68,8 @@ #define ARRAY_AND_SIZE(a) (a), ARRAY_SIZE(a) #endif - typedef int (*receive_data_callback) (int fd, int revents, void *user_data); - /* Data types used by hardware plugins for set_configuration() */ enum { T_UINT64, @@ -91,8 +87,6 @@ struct protocol { int stackindex; }; - - /* datafeed_packet.type values */ enum { DF_HEADER, @@ -119,8 +113,6 @@ struct datafeed_header { int num_logic_probes; }; - - struct input { struct input_format *format; char *param; @@ -135,8 +127,6 @@ struct input_format { int (*loadfile) (struct input *in, const char *filename); }; - - struct output { struct output_format *format; struct device *device; @@ -155,7 +145,6 @@ struct output_format { uint64_t *length_out); }; - struct analyzer { char *name; char *filename; @@ -165,7 +154,6 @@ struct analyzer { */ }; - /* Size of a chunk in units */ #define DATASTORE_CHUNKSIZE 512000 @@ -176,7 +164,6 @@ struct datastore { GSList *chunklist; }; - /* * This represents a generic device connected to the system. * For device-specific information, ask the plugin. The plugin_index refers @@ -209,7 +196,6 @@ struct probe { extern GSList *devices; - /* Hardware plugin capabilities */ enum { HWCAP_DUMMY, /* Used to terminate lists */ @@ -235,7 +221,6 @@ struct hwcap_option { char *shortname; }; - struct sigrok_device_instance { int index; int status;