]> git.ipfire.org Git - thirdparty/samba.git/commitdiff
lib/audit_logging: make json_{is_invalid,to_string}() accept a const*
authorPhilipp Gesang <philipp.gesang@intra2net.com>
Mon, 9 Jul 2018 07:41:37 +0000 (09:41 +0200)
committerAndrew Bartlett <abartlet@samba.org>
Sat, 22 Sep 2018 04:05:06 +0000 (06:05 +0200)
Allow for json_is_invalid() and json_to_string() to be used on a
const pointer. Neither function requires for the json object to
be mutable so constraining them to non-const* is unnecessary.

Reviewed-by: Gary Lockyer <gary@catalyst.net.nz>
Signed-off-by: Philipp Gesang <philipp.gesang@intra2net.com>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
lib/audit_logging/audit_logging.c
lib/audit_logging/audit_logging.h

index ac08863129a756f230f1a370e7352673b0331679..c274e9719255ac5551d635416cce4212eb85b375 100644 (file)
@@ -355,7 +355,7 @@ void json_free(struct json_object *object)
  * @return is the object valid?
  *
  */
-bool json_is_invalid(struct json_object *object)
+bool json_is_invalid(const struct json_object *object)
 {
        return !object->valid;
 }
@@ -907,7 +907,7 @@ int json_add_guid(struct json_object *object,
  * @return A string representation of the object or NULL if the object
  *         is invalid.
  */
-char *json_to_string(TALLOC_CTX *mem_ctx, struct json_object *object)
+char *json_to_string(TALLOC_CTX *mem_ctx, const struct json_object *object)
 {
        char *json = NULL;
        char *json_string = NULL;
index 4203743f315955c5f8836eb85fb36d3bad4b1f4b..5f095c0df9a4413a4fde3c19e67743279c88b3f4 100644 (file)
@@ -55,7 +55,7 @@ _WARN_UNUSED_RESULT_ struct json_object json_new_object(void);
 _WARN_UNUSED_RESULT_ struct json_object json_new_array(void);
 void json_free(struct json_object *object);
 void json_assert_is_array(struct json_object *array);
-_WARN_UNUSED_RESULT_ bool json_is_invalid(struct json_object *object);
+_WARN_UNUSED_RESULT_ bool json_is_invalid(const struct json_object *object);
 
 _WARN_UNUSED_RESULT_ int json_add_int(struct json_object *object,
                                      const char *name,
@@ -93,6 +93,6 @@ _WARN_UNUSED_RESULT_ struct json_object json_get_array(
 _WARN_UNUSED_RESULT_ struct json_object json_get_object(
     struct json_object *object, const char *name);
 _WARN_UNUSED_RESULT_ char *json_to_string(TALLOC_CTX *mem_ctx,
-                                         struct json_object *object);
+                                         const struct json_object *object);
 #endif
 #endif