Merge branch 'bb/pedantic'
The codebase has been updated to compile cleanly with -pedantic option. * bb/pedantic: utf8.c: avoid char overflow string-list.c: avoid conversion from void * to function pointer sequencer.c: avoid empty statements at top level convert.c: replace "\e" escapes with "\033". fixup! refs/refs-internal.h: avoid forward declaration of an enum refs/refs-internal.h: avoid forward declaration of an enum fixup! connect.h: avoid forward declaration of an enum connect.h: avoid forward declaration of an enum
This commit is contained in:
commit
00da9b2091
@ -1,6 +1,8 @@
|
|||||||
#ifndef CONNECT_H
|
#ifndef CONNECT_H
|
||||||
#define CONNECT_H
|
#define CONNECT_H
|
||||||
|
|
||||||
|
#include "protocol.h"
|
||||||
|
|
||||||
#define CONNECT_VERBOSE (1u << 0)
|
#define CONNECT_VERBOSE (1u << 0)
|
||||||
#define CONNECT_DIAG_URL (1u << 1)
|
#define CONNECT_DIAG_URL (1u << 1)
|
||||||
#define CONNECT_IPV4 (1u << 2)
|
#define CONNECT_IPV4 (1u << 2)
|
||||||
|
@ -335,7 +335,7 @@ static void trace_encoding(const char *context, const char *path,
|
|||||||
strbuf_addf(&trace, "%s (%s, considered %s):\n", context, path, encoding);
|
strbuf_addf(&trace, "%s (%s, considered %s):\n", context, path, encoding);
|
||||||
for (i = 0; i < len && buf; ++i) {
|
for (i = 0; i < len && buf; ++i) {
|
||||||
strbuf_addf(
|
strbuf_addf(
|
||||||
&trace,"| \e[2m%2i:\e[0m %2x \e[2m%c\e[0m%c",
|
&trace, "| \033[2m%2i:\033[0m %2x \033[2m%c\033[0m%c",
|
||||||
i,
|
i,
|
||||||
(unsigned char) buf[i],
|
(unsigned char) buf[i],
|
||||||
(buf[i] > 32 && buf[i] < 127 ? buf[i] : ' '),
|
(buf[i] > 32 && buf[i] < 127 ? buf[i] : ' '),
|
||||||
|
2
path.h
2
path.h
@ -147,7 +147,7 @@ extern void report_linked_checkout_garbage(void);
|
|||||||
/*
|
/*
|
||||||
* You can define a static memoized git path like:
|
* You can define a static memoized git path like:
|
||||||
*
|
*
|
||||||
* static GIT_PATH_FUNC(git_path_foo, "FOO");
|
* static GIT_PATH_FUNC(git_path_foo, "FOO")
|
||||||
*
|
*
|
||||||
* or use one of the global ones below.
|
* or use one of the global ones below.
|
||||||
*/
|
*/
|
||||||
|
@ -1,6 +1,8 @@
|
|||||||
#ifndef REFS_REFS_INTERNAL_H
|
#ifndef REFS_REFS_INTERNAL_H
|
||||||
#define REFS_REFS_INTERNAL_H
|
#define REFS_REFS_INTERNAL_H
|
||||||
|
|
||||||
|
#include "iterator.h"
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Data structures and functions for the internal use of the refs
|
* Data structures and functions for the internal use of the refs
|
||||||
* module. Code outside of the refs module should use only the public
|
* module. Code outside of the refs module should use only the public
|
||||||
|
@ -63,12 +63,12 @@ static GIT_PATH_FUNC(rebase_path_done, "rebase-merge/done")
|
|||||||
* The file to keep track of how many commands were already processed (e.g.
|
* The file to keep track of how many commands were already processed (e.g.
|
||||||
* for the prompt).
|
* for the prompt).
|
||||||
*/
|
*/
|
||||||
static GIT_PATH_FUNC(rebase_path_msgnum, "rebase-merge/msgnum");
|
static GIT_PATH_FUNC(rebase_path_msgnum, "rebase-merge/msgnum")
|
||||||
/*
|
/*
|
||||||
* The file to keep track of how many commands are to be processed in total
|
* The file to keep track of how many commands are to be processed in total
|
||||||
* (e.g. for the prompt).
|
* (e.g. for the prompt).
|
||||||
*/
|
*/
|
||||||
static GIT_PATH_FUNC(rebase_path_msgtotal, "rebase-merge/end");
|
static GIT_PATH_FUNC(rebase_path_msgtotal, "rebase-merge/end")
|
||||||
/*
|
/*
|
||||||
* The commit message that is planned to be used for any changes that
|
* The commit message that is planned to be used for any changes that
|
||||||
* need to be committed following a user interaction.
|
* need to be committed following a user interaction.
|
||||||
|
@ -224,18 +224,28 @@ struct string_list_item *string_list_append(struct string_list *list,
|
|||||||
list->strdup_strings ? xstrdup(string) : (char *)string);
|
list->strdup_strings ? xstrdup(string) : (char *)string);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Encapsulate the compare function pointer because ISO C99 forbids
|
||||||
|
* casting from void * to a function pointer and vice versa.
|
||||||
|
*/
|
||||||
|
struct string_list_sort_ctx
|
||||||
|
{
|
||||||
|
compare_strings_fn cmp;
|
||||||
|
};
|
||||||
|
|
||||||
static int cmp_items(const void *a, const void *b, void *ctx)
|
static int cmp_items(const void *a, const void *b, void *ctx)
|
||||||
{
|
{
|
||||||
compare_strings_fn cmp = ctx;
|
struct string_list_sort_ctx *sort_ctx = ctx;
|
||||||
const struct string_list_item *one = a;
|
const struct string_list_item *one = a;
|
||||||
const struct string_list_item *two = b;
|
const struct string_list_item *two = b;
|
||||||
return cmp(one->string, two->string);
|
return sort_ctx->cmp(one->string, two->string);
|
||||||
}
|
}
|
||||||
|
|
||||||
void string_list_sort(struct string_list *list)
|
void string_list_sort(struct string_list *list)
|
||||||
{
|
{
|
||||||
QSORT_S(list->items, list->nr, cmp_items,
|
struct string_list_sort_ctx sort_ctx = {list->cmp ? list->cmp : strcmp};
|
||||||
list->cmp ? list->cmp : strcmp);
|
|
||||||
|
QSORT_S(list->items, list->nr, cmp_items, &sort_ctx);
|
||||||
}
|
}
|
||||||
|
|
||||||
struct string_list_item *unsorted_string_list_lookup(struct string_list *list,
|
struct string_list_item *unsorted_string_list_lookup(struct string_list *list,
|
||||||
|
8
utf8.c
8
utf8.c
@ -566,10 +566,10 @@ static int has_bom_prefix(const char *data, size_t len,
|
|||||||
return data && bom && (len >= bom_len) && !memcmp(data, bom, bom_len);
|
return data && bom && (len >= bom_len) && !memcmp(data, bom, bom_len);
|
||||||
}
|
}
|
||||||
|
|
||||||
static const char utf16_be_bom[] = {0xFE, 0xFF};
|
static const char utf16_be_bom[] = {'\xFE', '\xFF'};
|
||||||
static const char utf16_le_bom[] = {0xFF, 0xFE};
|
static const char utf16_le_bom[] = {'\xFF', '\xFE'};
|
||||||
static const char utf32_be_bom[] = {0x00, 0x00, 0xFE, 0xFF};
|
static const char utf32_be_bom[] = {'\0', '\0', '\xFE', '\xFF'};
|
||||||
static const char utf32_le_bom[] = {0xFF, 0xFE, 0x00, 0x00};
|
static const char utf32_le_bom[] = {'\xFF', '\xFE', '\0', '\0'};
|
||||||
|
|
||||||
int has_prohibited_utf_bom(const char *enc, const char *data, size_t len)
|
int has_prohibited_utf_bom(const char *enc, const char *data, size_t len)
|
||||||
{
|
{
|
||||||
|
Loading…
Reference in New Issue
Block a user