libosmocore[master]: gsmtap_sendmsg(): clarify API doc concerning msgb ownership
Patch Set 1: yeah, I first wanted to fix the current situation, then maybe add a new function after that, but at that point I went back to the other issues... -- To view, visit https://gerrit.osmocom.org/6512 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: comment Gerrit-Change-Id: Id3266ce36442024f16eaf6afa3f516d201930c41 Gerrit-PatchSet: 1 Gerrit-Project: libosmocore Gerrit-Branch: master Gerrit-Owner: Neels HofmeyrGerrit-Reviewer: Harald Welte Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: Neels Hofmeyr Gerrit-Reviewer: Vadim Yanitskiy Gerrit-HasComments: No
[MERGED] libosmocore[master]: gsmtap_sendmsg(): clarify API doc concerning msgb ownership
Neels Hofmeyr has submitted this change and it was merged. Change subject: gsmtap_sendmsg(): clarify API doc concerning msgb ownership .. gsmtap_sendmsg(): clarify API doc concerning msgb ownership Not freeing on error does enable callers to try to re-send as well, so it is a kind of useful feature, even though I find it likely for callers to either forget about freeing the msg on error or double-free by accident... I considered changing gsmtap_sendmsg() to always free, but since it is public API, I chose to keep and document its current behavior properly instead. We don't know what callers may exist out there. Change-Id: Id3266ce36442024f16eaf6afa3f516d201930c41 --- M src/gsmtap_util.c 1 file changed, 3 insertions(+), 0 deletions(-) Approvals: Vadim Yanitskiy: Looks good to me, but someone else must approve Harald Welte: Looks good to me, approved Jenkins Builder: Verified diff --git a/src/gsmtap_util.c b/src/gsmtap_util.c index 8f9496a..8c044b1 100644 --- a/src/gsmtap_util.c +++ b/src/gsmtap_util.c @@ -266,6 +266,9 @@ * \param[in] gti GSMTAP instance * \param[in] msg message buffer * \return 0 in case of success; negative in case of error + * NOTE: in case of nonzero return value, the *caller* must free the msg! + * (This enables the caller to attempt re-sending the message.) + * If 0 is returned, the msgb was freed by this function. */ int gsmtap_sendmsg(struct gsmtap_inst *gti, struct msgb *msg) { -- To view, visit https://gerrit.osmocom.org/6512 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: merged Gerrit-Change-Id: Id3266ce36442024f16eaf6afa3f516d201930c41 Gerrit-PatchSet: 1 Gerrit-Project: libosmocore Gerrit-Branch: master Gerrit-Owner: Neels HofmeyrGerrit-Reviewer: Harald Welte Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: Neels Hofmeyr Gerrit-Reviewer: Vadim Yanitskiy
libosmocore[master]: gsmtap_sendmsg(): clarify API doc concerning msgb ownership
Patch Set 1: Code-Review+2 we could have added a new function that includes the free, something lie gsmtap_sendmsg_free() and then migrate new cold over, deprecate the old API, ... -- To view, visit https://gerrit.osmocom.org/6512 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: comment Gerrit-Change-Id: Id3266ce36442024f16eaf6afa3f516d201930c41 Gerrit-PatchSet: 1 Gerrit-Project: libosmocore Gerrit-Branch: master Gerrit-Owner: Neels HofmeyrGerrit-Reviewer: Harald Welte Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: Vadim Yanitskiy Gerrit-HasComments: No
libosmocore[master]: gsmtap_sendmsg(): clarify API doc concerning msgb ownership
Patch Set 1: Code-Review+1 -- To view, visit https://gerrit.osmocom.org/6512 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: comment Gerrit-Change-Id: Id3266ce36442024f16eaf6afa3f516d201930c41 Gerrit-PatchSet: 1 Gerrit-Project: libosmocore Gerrit-Branch: master Gerrit-Owner: Neels HofmeyrGerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: Vadim Yanitskiy Gerrit-HasComments: No
[PATCH] libosmocore[master]: gsmtap_sendmsg(): clarify API doc concerning msgb ownership
Review at https://gerrit.osmocom.org/6512 gsmtap_sendmsg(): clarify API doc concerning msgb ownership Not freeing on error does enable callers to try to re-send as well, so it is a kind of useful feature, even though I find it likely for callers to either forget about freeing the msg on error or double-free by accident... I considered changing gsmtap_sendmsg() to always free, but since it is public API, I chose to keep and document its current behavior properly instead. We don't know what callers may exist out there. Change-Id: Id3266ce36442024f16eaf6afa3f516d201930c41 --- M src/gsmtap_util.c 1 file changed, 3 insertions(+), 0 deletions(-) git pull ssh://gerrit.osmocom.org:29418/libosmocore refs/changes/12/6512/1 diff --git a/src/gsmtap_util.c b/src/gsmtap_util.c index 8f9496a..8c044b1 100644 --- a/src/gsmtap_util.c +++ b/src/gsmtap_util.c @@ -266,6 +266,9 @@ * \param[in] gti GSMTAP instance * \param[in] msg message buffer * \return 0 in case of success; negative in case of error + * NOTE: in case of nonzero return value, the *caller* must free the msg! + * (This enables the caller to attempt re-sending the message.) + * If 0 is returned, the msgb was freed by this function. */ int gsmtap_sendmsg(struct gsmtap_inst *gti, struct msgb *msg) { -- To view, visit https://gerrit.osmocom.org/6512 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: newchange Gerrit-Change-Id: Id3266ce36442024f16eaf6afa3f516d201930c41 Gerrit-PatchSet: 1 Gerrit-Project: libosmocore Gerrit-Branch: master Gerrit-Owner: Neels Hofmeyr