From: Naveen Albert Date: Fri, 16 Dec 2022 18:25:52 +0000 (+0000) Subject: json.h: Add ast_json_object_real_get. X-Git-Tag: 18.17.0-rc1~32 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=811584ded3fb482e8bfff1dc950ee756f80008c1;p=thirdparty%2Fasterisk.git 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 --- diff --git a/include/asterisk/json.h b/include/asterisk/json.h index 9c42c3f13d..5edc3a9754 100644 --- a/include/asterisk/json.h +++ b/include/asterisk/json.h @@ -592,6 +592,15 @@ struct ast_json *ast_json_object_get(struct ast_json *object, const char *key); */ #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