You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

80 lines
2.0 KiB

  1. From 0793c64ee8ebbcea86b7a9dc71c7e28ec08db618 Mon Sep 17 00:00:00 2001
  2. From: Oliver Jowett <oliver.jowett@flightaware.com>
  3. Date: Sat, 6 Jun 2020 21:52:04 +0800
  4. Subject: [PATCH] Clean up linkage of struct Modes to actually make sense.
  5. (how did this work before? But it's been unchanged since at least
  6. 2013..)
  7. Maybe fixes #65
  8. ---
  9. dump1090.c | 2 ++
  10. dump1090.h | 6 ++++--
  11. faup1090.c | 2 ++
  12. view1090.c | 3 +++
  13. 4 files changed, 11 insertions(+), 2 deletions(-)
  14. diff --git a/dump1090.c b/dump1090.c
  15. index 2b5c4dce..bc1a7bb9 100644
  16. --- a/dump1090.c
  17. +++ b/dump1090.c
  18. @@ -51,6 +51,8 @@
  19. #include <stdarg.h>
  20. +struct _Modes Modes;
  21. +
  22. //
  23. // ============================= Utility functions ==========================
  24. //
  25. diff --git a/dump1090.h b/dump1090.h
  26. index 5c7cf73e..1afc3d35 100644
  27. --- a/dump1090.h
  28. +++ b/dump1090.h
  29. @@ -295,7 +295,7 @@ struct mag_buf {
  30. };
  31. // Program global state
  32. -struct { // Internal state
  33. +struct _Modes { // Internal state
  34. pthread_t reader_thread;
  35. pthread_mutex_t data_mutex; // Mutex to synchronize buffer access
  36. @@ -397,7 +397,9 @@ struct { // Internal state
  37. int stats_latest_1min;
  38. struct stats stats_5min;
  39. struct stats stats_15min;
  40. -} Modes;
  41. +};
  42. +
  43. +extern struct _Modes Modes;
  44. // The struct we use to store information about a decoded message.
  45. struct modesMessage {
  46. diff --git a/faup1090.c b/faup1090.c
  47. index cd2be929..cf83db9d 100644
  48. --- a/faup1090.c
  49. +++ b/faup1090.c
  50. @@ -49,6 +49,8 @@
  51. #include "dump1090.h"
  52. +struct _Modes Modes;
  53. +
  54. #include <stdarg.h>
  55. void receiverPositionChanged(float lat, float lon, float alt)
  56. diff --git a/view1090.c b/view1090.c
  57. index ae925f5e..a8797bb8 100644
  58. --- a/view1090.c
  59. +++ b/view1090.c
  60. @@ -28,6 +28,9 @@
  61. // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  62. //
  63. #include "dump1090.h"
  64. +
  65. +struct _Modes Modes;
  66. +
  67. //
  68. // ============================= Utility functions ==========================
  69. //