static ssize_t find_unique(const char *string, struct prefix_item_list *list)
{
bool exact_match;
- int index = string_list_find_insert_index(&list->sorted, string, &exact_match);
+ size_t index = string_list_find_insert_index(&list->sorted, string, &exact_match);
struct string_list_item *item;
if (list->items.nr != list->sorted.nr)
#define USE_THE_REPOSITORY_VARIABLE
-#define DISABLE_SIGN_COMPARE_WARNINGS
#include "git-compat-util.h"
#include "environment.h"
const char *string, size_t len)
{
bool exact_match;
- int i = string_list_find_insert_index(map, string, &exact_match);
+ size_t i = string_list_find_insert_index(map, string, &exact_match);
if (exact_match) {
if (!string[len])
return &map->items[i];
* overlong key would be inserted, which must come after the
* real location of the key if one exists.
*/
- while (0 <= --i && i < map->nr) {
+ while (i-- && i < map->nr) {
int cmp = strncasecmp(map->items[i].string, string, len);
if (cmp < 0)
/*
const struct string_list *extras,
const struct string_list *skip)
{
- int pos;
-
if (!extras)
return NULL;
* with dirname (remember, dirname includes the trailing
* slash) and is not in skip, then we have a conflict.
*/
- for (pos = string_list_find_insert_index(extras, dirname, NULL);
+ for (size_t pos = string_list_find_insert_index(extras, dirname, NULL);
pos < extras->nr; pos++) {
const char *extra_refname = extras->items[pos].string;
return exact_match;
}
-int string_list_find_insert_index(const struct string_list *list, const char *string,
- bool *exact_match)
+size_t string_list_find_insert_index(const struct string_list *list, const char *string,
+ bool *exact_match)
{
return get_entry_index(list, string, exact_match);
}
/** Determine if the string_list has a given string or not. */
bool string_list_has_string(const struct string_list *list, const char *string);
-int string_list_find_insert_index(const struct string_list *list, const char *string,
- bool *exact_match);
+size_t string_list_find_insert_index(const struct string_list *list, const char *string,
+ bool *exact_match);
/**
* Insert a new element to the string_list. The returned pointer can