pespin has uploaded this change for review. ( 
https://gerrit.osmocom.org/c/osmo-pcu/+/41881?usp=email )


Change subject: Avoid accessing struct log_target members directly
......................................................................

Avoid accessing struct log_target members directly

Use newly available APIs instead.

Change-Id: Ib6e34e948e4ad9b8a8883febf54b31345c3bcd97
Depends: libosmocore.git Change-Id Ie48e7e635feb91509b9c034394df4fb16cb931a3
---
M TODO-RELEASE
M src/gprs_debug.c
2 files changed, 7 insertions(+), 6 deletions(-)



  git pull ssh://gerrit.osmocom.org:29418/osmo-pcu refs/changes/81/41881/1

diff --git a/TODO-RELEASE b/TODO-RELEASE
index 0ed7189..fb115da 100644
--- a/TODO-RELEASE
+++ b/TODO-RELEASE
@@ -7,3 +7,4 @@
 # If any interfaces have been added since the last public release: c:r:a + 1.
 # If any interfaces have been removed or changed since the last public 
release: c:r:0.
 #library       what                    description / commit summary line
+libosmocore >1.12.0 log_get_context(), log_{get,set}_filter(_data)()
diff --git a/src/gprs_debug.c b/src/gprs_debug.c
index ba9aeec..6813c06 100644
--- a/src/gprs_debug.c
+++ b/src/gprs_debug.c
@@ -147,17 +147,17 @@
 static int filter_fn(const struct log_context *ctx,
                     struct log_target *tar)
 {
-       const struct gprs_nsvc *nsvc = (const struct 
gprs_nsvc*)ctx->ctx[LOG_CTX_GB_NSVC];
-       const struct gprs_nsvc *bvc = (const struct 
gprs_nsvc*)ctx->ctx[LOG_CTX_GB_BVC];
+       const struct gprs_nsvc *nsvc = (const struct gprs_nsvc 
*)log_get_context(ctx, LOG_CTX_GB_NSVC);
+       const struct gprs_nsvc *bvc = (const struct gprs_nsvc 
*)log_get_context(ctx, LOG_CTX_GB_BVC);

        /* Filter on the NS Virtual Connection */
-       if ((tar->filter_map & (1 << LOG_FLT_GB_NSVC)) != 0
-           && nsvc && (nsvc == tar->filter_data[LOG_FLT_GB_NSVC]))
+       if (log_get_filter(tar, LOG_FLT_GB_NSVC) &&
+           nsvc && (nsvc == log_get_filter_data(tar, LOG_FLT_GB_NSVC)))
                return 1;

        /* Filter on the BVC */
-       if ((tar->filter_map & (1 << LOG_FLT_GB_BVC)) != 0
-           && bvc && (bvc == tar->filter_data[LOG_FLT_GB_BVC]))
+       if (log_get_filter(tar, LOG_FLT_GB_BVC) &&
+           bvc && (bvc == log_get_filter_data(tar, LOG_FLT_GB_BVC)))
                return 1;

        return 0;

--
To view, visit https://gerrit.osmocom.org/c/osmo-pcu/+/41881?usp=email
To unsubscribe, or for help writing mail filters, visit 
https://gerrit.osmocom.org/settings?usp=email

Gerrit-MessageType: newchange
Gerrit-Project: osmo-pcu
Gerrit-Branch: master
Gerrit-Change-Id: Ib6e34e948e4ad9b8a8883febf54b31345c3bcd97
Gerrit-Change-Number: 41881
Gerrit-PatchSet: 1
Gerrit-Owner: pespin <[email protected]>

Reply via email to