projects
/
libam7xxx.git
/ commitdiff
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(from parent 1:
fc26cf1
)
am7xxx: assign device_list next to its first use
author
Antonio Ospite <ospite@studenti.unina.it>
Wed, 14 Nov 2012 11:01:34 +0000
(12:01 +0100)
committer
Antonio Ospite <ospite@studenti.unina.it>
Wed, 14 Nov 2012 11:26:42 +0000
(12:26 +0100)
This makes the code a little more readable.
src/am7xxx.c
patch
|
blob
|
history
diff --git
a/src/am7xxx.c
b/src/am7xxx.c
index
08858cd
..
47e04bb
100644
(file)
--- a/
src/am7xxx.c
+++ b/
src/am7xxx.c
@@
-453,8
+453,6
@@
static am7xxx_device *add_new_device(am7xxx_context *ctx)
return NULL;
}
- devices_list = &(ctx->devices_list);
-
new_device = malloc(sizeof(*new_device));
if (new_device == NULL) {
fatal("cannot allocate a new device (%s)\n", strerror(errno));
@@
-464,6
+462,8
@@
static am7xxx_device *add_new_device(am7xxx_context *ctx)
new_device->ctx = ctx;
+ devices_list = &(ctx->devices_list);
+
if (*devices_list == NULL) {
*devices_list = new_device;
} else {