@@ -44,6 +44,9 @@ static const char *unordered_arrays[] = {
44
44
// Count of unordered array fields
45
45
#define UNORDERED_ARRAYS_COUNT (sizeof(unordered_arrays) / sizeof(unordered_arrays[0]))
46
46
47
+ // Forward declarations
48
+ static cJSON_bool aws_policy_compare_items (const cJSON * a , const cJSON * b , int parent_is_unordered );
49
+
47
50
// Check if a field name is in the list of unordered arrays
48
51
static int is_unordered_array (const char * field_name ) {
49
52
for (int i = 0 ; i < UNORDERED_ARRAYS_COUNT ; i ++ ) {
@@ -73,6 +76,12 @@ static int aws_service_compare(const char *str1, const char *str2) {
73
76
return * str1 == * str2 ;
74
77
}
75
78
79
+ // Compare doubles with appropriate epsilon
80
+ static cJSON_bool compare_double (double a , double b ) {
81
+ double maxVal = fabs (a ) > fabs (b ) ? fabs (a ) : fabs (b );
82
+ return (fabs (a - b ) <= maxVal * DBL_EPSILON );
83
+ }
84
+
76
85
// Find an element in an array by value (for unordered comparison)
77
86
static cJSON * find_matching_element (const cJSON * array , const cJSON * item , int parent_is_unordered ) {
78
87
cJSON * element ;
@@ -211,17 +220,6 @@ static cJSON_bool aws_policy_compare_items(const cJSON *a, const cJSON *b, int p
211
220
}
212
221
}
213
222
214
- // Forward declarations
215
- static cJSON_bool aws_policy_compare_items (const cJSON * a , const cJSON * b , int parent_is_unordered );
216
- static cJSON * find_matching_element (const cJSON * array , const cJSON * item , int parent_is_unordered );
217
- static cJSON_bool compare_double (double a , double b );
218
-
219
- // Compare doubles with appropriate epsilon
220
- static cJSON_bool compare_double (double a , double b ) {
221
- double maxVal = fabs (a ) > fabs (b ) ? fabs (a ) : fabs (b );
222
- return (fabs (a - b ) <= maxVal * DBL_EPSILON );
223
- }
224
-
225
223
static void aws_policy_equal (sqlite3_context * context , int argc , sqlite3_value * * argv ) {
226
224
if (argc != 2 ) {
227
225
sqlite3_result_error (context , "aws_policy_equal() requires exactly two arguments" , -1 );
0 commit comments