Share a single str_starts() implementation

No need to define this as a static function in multiple files.

Signed-off-by: Jouni Malinen <j@w1.fi>
This commit is contained in:
Jouni Malinen 2016-08-06 12:38:21 +03:00
parent 23c130e9b7
commit e55df99ee6
6 changed files with 8 additions and 24 deletions

View file

@ -92,12 +92,6 @@ static int get_cmd_arg_num(const char *str, int pos)
} }
static int str_starts(const char *src, const char *match)
{
return os_strncmp(src, match, os_strlen(match)) == 0;
}
static void register_event_handler(struct wpa_ctrl *ctrl) static void register_event_handler(struct wpa_ctrl *ctrl)
{ {
if (!ctrl_conn) if (!ctrl_conn)

View file

@ -269,12 +269,6 @@ static void hostapd_wps_enrollee_seen_cb(void *ctx, const u8 *addr,
} }
static int str_starts(const char *str, const char *start)
{
return os_strncmp(str, start, os_strlen(start)) == 0;
}
static void wps_reload_config(void *eloop_data, void *user_ctx) static void wps_reload_config(void *eloop_data, void *user_ctx)
{ {
struct hostapd_iface *iface = eloop_data; struct hostapd_iface *iface = eloop_data;

View file

@ -1194,3 +1194,9 @@ int ssid_parse(const char *buf, struct wpa_ssid_value *ssid)
return ssid->ssid_len ? 0 : -1; return ssid->ssid_len ? 0 : -1;
} }
int str_starts(const char *str, const char *start)
{
return os_strncmp(str, start, os_strlen(start)) == 0;
}

View file

@ -550,6 +550,8 @@ size_t utf8_unescape(const char *inp, size_t in_size,
char *outp, size_t out_size); char *outp, size_t out_size);
int is_ctrl_char(char c); int is_ctrl_char(char c);
int str_starts(const char *str, const char *start);
/* /*
* gcc 4.4 ends up generating strict-aliasing warnings about some very common * gcc 4.4 ends up generating strict-aliasing warnings about some very common

View file

@ -100,12 +100,6 @@ static int line_length(const char *l)
} }
static int str_starts(const char *str, const char *start)
{
return os_strncmp(str, start, os_strlen(start)) == 0;
}
/*************************************************************************** /***************************************************************************
* Advertisements. * Advertisements.
* These are multicast to the world to tell them we are here. * These are multicast to the world to tell them we are here.

View file

@ -108,12 +108,6 @@ static int get_cmd_arg_num(const char *str, int pos)
} }
static int str_starts(const char *src, const char *match)
{
return os_strncmp(src, match, os_strlen(match)) == 0;
}
static int wpa_cli_show_event(const char *event) static int wpa_cli_show_event(const char *event)
{ {
const char *start; const char *start;