From c166d36009b7728d723b0d928e09d56db8177a01 Mon Sep 17 00:00:00 2001 From: Letu Ren Date: Wed, 10 Jan 2024 15:02:08 +0800 Subject: [PATCH] Fix wrong declaration of jv_string_value MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Currently, there is a warning when building wheel. ``` jq.c: In function ‘__pyx_f_2jq_jv_string_to_py_string’: jq.c:12111:24: warning: assignment discards ‘const’ qualifier from pointer target type [-Wdiscarded-qualifiers] 12111 | __pyx_v_string_value = jv_string_value(__pyx_v_value); | ``` This is because the type of return value of `jv_string_value` is `const char *` instead of `char *`. This is not an API change. The function returns `const char *` when it becomes available. --- jq.pyx | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/jq.pyx b/jq.pyx index 0f580c4..1512d77 100644 --- a/jq.pyx +++ b/jq.pyx @@ -27,7 +27,7 @@ cdef extern from "jv.h": void jv_free(jv) jv jv_invalid_get_msg(jv) int jv_invalid_has_msg(jv) - char* jv_string_value(jv) + const char* jv_string_value(jv) jv jv_dump_string(jv, int flags) int jv_string_length_bytes(jv) int jv_is_integer(jv) @@ -420,5 +420,5 @@ def jq(object program): cdef unicode jv_string_to_py_string(jv value): cdef int length = jv_string_length_bytes(jv_copy(value)) - cdef char* string_value = jv_string_value(value) + cdef const char* string_value = jv_string_value(value) return string_value[:length].decode("utf-8")