diff options
| author | Henrik Rydberg <rydberg@euromail.se> | 2010-12-21 17:29:14 +0100 |
|---|---|---|
| committer | Henrik Rydberg <rydberg@euromail.se> | 2010-12-21 17:29:14 +0100 |
| commit | 1bc6faa48907919376b14429f3b802d0d16fc00a (patch) | |
| tree | 73e57b6f956d8f50c456330c878e9b210ad41483 /tools/evemu-describe.c | |
| parent | a8df0405686350c3145b3e5119d796c6642339fd (diff) | |
Make evemu ABI resilient
Hide the evemu struct, make it versioned, and instead use new/delete
and accessor functions. This should give us enough ABI stability to
run mixed library implementations.
Signed-off-by: Henrik Rydberg <rydberg@euromail.se>
Diffstat (limited to 'tools/evemu-describe.c')
| -rw-r--r-- | tools/evemu-describe.c | 19 |
1 files changed, 12 insertions, 7 deletions
diff --git a/tools/evemu-describe.c b/tools/evemu-describe.c index ec6b1ef..6c6cdab 100644 --- a/tools/evemu-describe.c +++ b/tools/evemu-describe.c | |||
| @@ -26,22 +26,27 @@ | |||
| 26 | * | 26 | * |
| 27 | ****************************************************************************/ | 27 | ****************************************************************************/ |
| 28 | 28 | ||
| 29 | #include "evemu.h" | 29 | #include <evemu.h> |
| 30 | #include <stdio.h> | 30 | #include <stdio.h> |
| 31 | #include <fcntl.h> | 31 | #include <fcntl.h> |
| 32 | #include <string.h> | 32 | #include <string.h> |
| 33 | 33 | ||
| 34 | static int describe_device(int fd) | 34 | static int describe_device(int fd) |
| 35 | { | 35 | { |
| 36 | struct evemu_device dev; | 36 | struct evemu_device *dev; |
| 37 | int ret; | 37 | int ret = -ENOMEM; |
| 38 | 38 | ||
| 39 | ret = evemu_extract(&dev, fd); | 39 | dev = evemu_new(0); |
| 40 | if (!dev) | ||
| 41 | goto out; | ||
| 42 | ret = evemu_extract(dev, fd); | ||
| 40 | if (ret) | 43 | if (ret) |
| 41 | return ret; | 44 | goto out; |
| 42 | evemu_write(&dev, stdout); | ||
| 43 | 45 | ||
| 44 | return 0; | 46 | evemu_write(dev, stdout); |
| 47 | out: | ||
| 48 | evemu_delete(dev); | ||
| 49 | return ret; | ||
| 45 | } | 50 | } |
| 46 | 51 | ||
| 47 | int main(int argc, char *argv[]) | 52 | int main(int argc, char *argv[]) |
