[Asterisk-code-review] json.h: Add ast_json_object_real_get. (asterisk[18])

George Joseph asteriskteam at digium.com
Wed Jan 4 05:52:08 CST 2023


George Joseph has submitted this change. ( https://gerrit.asterisk.org/c/asterisk/+/19734 )

Change subject: json.h: Add ast_json_object_real_get.
......................................................................

json.h: Add ast_json_object_real_get.

json.h contains macros to get a string and an integer
from a JSON object. However, the macro to do this for
JSON reals is missing. This adds that.

ASTERISK-30361 #close

Change-Id: I8d0e28d763febf27b05801cdc83b73282aa6ee7a
---
M include/asterisk/json.h
1 file changed, 24 insertions(+), 0 deletions(-)

Approvals:
  George Joseph: Looks good to me, approved; Approved for Submit




diff --git a/include/asterisk/json.h b/include/asterisk/json.h
index 9c42c3f..5edc3a9 100644
--- a/include/asterisk/json.h
+++ b/include/asterisk/json.h
@@ -593,6 +593,15 @@
 #define ast_json_object_integer_get(object, key) ast_json_integer_get(ast_json_object_get(object, key))
 
 /*!
+ * \brief Get a double field from a JSON object.
+ * \param object JSON object.
+ * \param key Key of double field to look up.
+ * \return Value of a JSON double.
+ * \retval 0 if \a real is not a JSON real number.
+ */
+#define ast_json_object_real_get(object, key) ast_json_real_get(ast_json_object_get(object, key))
+
+/*!
  * \brief Set a field in a JSON object.
  * \since 12.0.0
  *

-- 
To view, visit https://gerrit.asterisk.org/c/asterisk/+/19734
To unsubscribe, or for help writing mail filters, visit https://gerrit.asterisk.org/settings

Gerrit-Project: asterisk
Gerrit-Branch: 18
Gerrit-Change-Id: I8d0e28d763febf27b05801cdc83b73282aa6ee7a
Gerrit-Change-Number: 19734
Gerrit-PatchSet: 2
Gerrit-Owner: N A <asterisk at phreaknet.org>
Gerrit-Reviewer: Friendly Automation
Gerrit-Reviewer: George Joseph <gjoseph at digium.com>
Gerrit-MessageType: merged
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.digium.com/pipermail/asterisk-code-review/attachments/20230104/650d794b/attachment-0001.html>


More information about the asterisk-code-review mailing list