Skip to content

Commit

Permalink
cleanup: extern -> static
Browse files Browse the repository at this point in the history
in particular, this fixes a compiler warning:
sql/sql_lex.h:406:19: warning: ‘sp_data_access_name’ defined but not used [-Wunused-variable]
  • Loading branch information
vuvova committed Aug 2, 2023
1 parent f9003c7 commit 98de117
Show file tree
Hide file tree
Showing 6 changed files with 29 additions and 44 deletions.
34 changes: 20 additions & 14 deletions sql/item_jsonfunc.cc
Expand Up @@ -21,6 +21,10 @@
#include "sql_parse.h" // For check_stack_overrun
#include "json_schema_helper.h"

static bool get_current_value(json_engine_t *, const uchar *&, size_t &);
static int check_overlaps(json_engine_t *, json_engine_t *, bool);
static int json_find_overlap_with_object(json_engine_t *, json_engine_t *, bool);

/*
Compare ASCII string against the string with the specified
character set.
Expand Down Expand Up @@ -4307,15 +4311,15 @@ bool Item_func_json_normalize::fix_length_and_dec(THD *thd)
left in the object that we no longer want to compare. In this case,
we want to skip the current item.
*/
void json_skip_current_level(json_engine_t *js, json_engine_t *value)
static void json_skip_current_level(json_engine_t *js, json_engine_t *value)
{
json_skip_level(js);
json_skip_level(value);
}


/* At least one of the two arguments is a scalar. */
bool json_find_overlap_with_scalar(json_engine_t *js, json_engine_t *value)
static bool json_find_overlap_with_scalar(json_engine_t *js, json_engine_t *value)
{
if (json_value_scalar(value))
{
Expand Down Expand Up @@ -4367,7 +4371,7 @@ bool json_find_overlap_with_scalar(json_engine_t *js, json_engine_t *value)
array is object, then compare the two objects entirely. If they are
equal return true else return false.
*/
bool json_compare_arr_and_obj(json_engine_t *js, json_engine_t *value)
static bool json_compare_arr_and_obj(json_engine_t *js, json_engine_t *value)
{
st_json_engine_t loc_val= *value;
while (json_scan_next(js) == 0 && js->state == JST_VALUE)
Expand Down Expand Up @@ -4415,7 +4419,7 @@ bool json_compare_arrays_in_order(json_engine_t *js, json_engine_t *value)
}


int json_find_overlap_with_array(json_engine_t *js, json_engine_t *value,
static int json_find_overlap_with_array(json_engine_t *js, json_engine_t *value,
bool compare_whole)
{
if (value->value_type == JSON_VALUE_ARRAY)
Expand Down Expand Up @@ -4500,7 +4504,9 @@ int compare_nested_object(json_engine_t *js, json_engine_t *value)

return MY_TEST(result);
}
int json_find_overlap_with_object(json_engine_t *js, json_engine_t *value,


static int json_find_overlap_with_object(json_engine_t *js, json_engine_t *value,
bool compare_whole)
{
if (value->value_type == JSON_VALUE_OBJECT)
Expand Down Expand Up @@ -4656,7 +4662,7 @@ int json_find_overlap_with_object(json_engine_t *js, json_engine_t *value,
FALSE - If two json documents do not overlap
TRUE - if two json documents overlap
*/
int check_overlaps(json_engine_t *js, json_engine_t *value, bool compare_whole)
static int check_overlaps(json_engine_t *js, json_engine_t *value, bool compare_whole)
{
DBUG_EXECUTE_IF("json_check_min_stack_requirement",
{
Expand Down Expand Up @@ -4984,8 +4990,8 @@ bool Item_func_json_key_value::fix_length_and_dec(THD *thd)
}


bool create_hash(json_engine_t *value, HASH *items, bool &hash_inited,
MEM_ROOT *hash_root)
static bool create_hash(json_engine_t *value, HASH *items, bool &hash_inited,
MEM_ROOT *hash_root)
{
int level= value->stack_p;
if (my_hash_init(PSI_INSTRUMENT_ME, items, value->s.cs, 0, 0, 0,
Expand Down Expand Up @@ -5042,8 +5048,8 @@ bool create_hash(json_engine_t *value, HASH *items, bool &hash_inited,
FALSE - The function was successfully completed without errors.
TRUE - An error occurred while running.
*/
bool get_current_value(json_engine_t *js, const uchar *&value_start,
size_t &value_len)
static bool get_current_value(json_engine_t *js, const uchar *&value_start,
size_t &value_len)
{
value_start= js->value_begin;

Expand Down Expand Up @@ -5072,8 +5078,8 @@ bool get_current_value(json_engine_t *js, const uchar *&value_start,
FALSE - if two array documents have intersection
TRUE - If two array documents do not have intersection
*/
bool get_intersect_between_arrays(String *str, json_engine_t *value,
HASH items)
static bool get_intersect_between_arrays(String *str, json_engine_t *value,
HASH items)
{
bool res= true, has_value= false;
int level= value->stack_p;
Expand Down Expand Up @@ -5228,7 +5234,7 @@ bool Item_func_json_array_intersect::fix_length_and_dec(THD *thd)
}


bool filter_keys(json_engine_t *je1, String *str, HASH items)
static bool filter_keys(json_engine_t *je1, String *str, HASH items)
{
int level= je1->stack_p;
String temp_str(0);
Expand Down Expand Up @@ -5380,7 +5386,7 @@ bool Item_func_json_object_filter_keys::fix_length_and_dec(THD *thd)
return FALSE;
}

bool convert_to_array(json_engine_t *je, String *str)
static bool convert_to_array(json_engine_t *je, String *str)
{
int level= je->stack_p;
String temp_str(0);
Expand Down
19 changes: 0 additions & 19 deletions sql/item_jsonfunc.h
Expand Up @@ -48,25 +48,6 @@ void report_path_error_ex(const char *ps, json_path_t *p,
void report_json_error_ex(const char *js, json_engine_t *je,
const char *fname, int n_param,
Sql_condition::enum_warning_level lv);
int check_overlaps(json_engine_t *js, json_engine_t *value, bool compare_whole);
int json_find_overlap_with_object(json_engine_t *js,
json_engine_t *value,
bool compare_whole);
void json_skip_current_level(json_engine_t *js, json_engine_t *value);
bool json_find_overlap_with_scalar(json_engine_t *js, json_engine_t *value);
bool json_compare_arrays_in_order_in_order(json_engine_t *js, json_engine_t *value);
bool json_compare_arr_and_obj(json_engine_t *js, json_engine_t* value);
int json_find_overlap_with_array(json_engine_t *js,
json_engine_t *value,
bool compare_whole);

bool create_hash(json_engine_t *value, HASH *items, bool &hash_inited);
bool create_item(LEX_CSTRING *&new_entry,
const uchar *value_start, size_t value_len);
bool get_current_value(json_engine_t *js, const uchar *&value_start,
size_t &value_len);
bool get_intersect_between_arrays(String *str,
json_engine_t *value);

class Json_engine_scan: public json_engine_t
{
Expand Down
2 changes: 1 addition & 1 deletion sql/sql_connect.cc
Expand Up @@ -1161,7 +1161,7 @@ void setup_connection_thread_globals(THD *thd)
1 error
*/

bool login_connection(THD *thd)
static bool login_connection(THD *thd)
{
NET *net= &thd->net;
int error= 0;
Expand Down
1 change: 0 additions & 1 deletion sql/sql_connect.h
Expand Up @@ -102,7 +102,6 @@ int thd_set_peer_addr(THD *thd, sockaddr_storage *addr,
bool check_proxy_networks,
uint *host_errors);

bool login_connection(THD *thd);
void prepare_new_connection_state(THD* thd);
void end_connection(THD *thd);
void update_global_user_stats(THD* thd, bool create_user, time_t now);
Expand Down
9 changes: 0 additions & 9 deletions sql/sql_lex.h
Expand Up @@ -403,15 +403,6 @@ enum enum_sp_data_access
SP_MODIFIES_SQL_DATA
};

const LEX_CSTRING sp_data_access_name[]=
{
{ STRING_WITH_LEN("") },
{ STRING_WITH_LEN("CONTAINS SQL") },
{ STRING_WITH_LEN("NO SQL") },
{ STRING_WITH_LEN("READS SQL DATA") },
{ STRING_WITH_LEN("MODIFIES SQL DATA") }
};

#define DERIVED_SUBQUERY 1
#define DERIVED_VIEW 2
#define DERIVED_WITH 4
Expand Down
8 changes: 8 additions & 0 deletions sql/sql_show.cc
Expand Up @@ -121,6 +121,14 @@ static const LEX_CSTRING trg_event_type_names[]=
{ STRING_WITH_LEN("DELETE") }
};

static const LEX_CSTRING sp_data_access_name[]=
{
{ STRING_WITH_LEN("") },
{ STRING_WITH_LEN("CONTAINS SQL") },
{ STRING_WITH_LEN("NO SQL") },
{ STRING_WITH_LEN("READS SQL DATA") },
{ STRING_WITH_LEN("MODIFIES SQL DATA") }
};

LEX_CSTRING DATA_clex_str= { STRING_WITH_LEN("DATA") };
LEX_CSTRING INDEX_clex_str= { STRING_WITH_LEN("INDEX") };
Expand Down

0 comments on commit 98de117

Please sign in to comment.