Cosmetics.

This commit is contained in:
Uwe Hermann 2011-01-15 15:43:25 +01:00
parent aa0b6b208e
commit 484760d1a8
5 changed files with 4 additions and 21 deletions

View File

@ -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();

View File

@ -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);

View File

@ -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)
{

View File

@ -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;
}

View File

@ -27,7 +27,6 @@
#include <glib.h>
#include <libusb.h>
/*
* 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;