Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions examples/glob/utils.c
Original file line number Diff line number Diff line change
Expand Up @@ -14,17 +14,17 @@ int
main(int argc, const char *argv[])
{
unsigned int count;
const char *patten;
const char *pattern;
bool result;

if (argc < 2) {
bfdev_log_alert("Usage: %s patten string ...\n", argv[0]);
bfdev_log_alert("Usage: %s pattern string ...\n", argv[0]);
return 1;
}

patten = argv[1];
pattern = argv[1];
for (count = 2; count < argc; ++count) {
result = bfdev_glob(patten, argv[count]);
result = bfdev_glob(pattern, argv[count]);
bfdev_log_info("matching %s: %s\n", argv[count], result ? "yes" : "no");
}

Expand Down
10 changes: 5 additions & 5 deletions examples/notifier/simple.c
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
#include <bfdev/notifier.h>

static
BFDEV_DEFINE_NOTIFIER(notifer);
BFDEV_DEFINE_NOTIFIER(notifier);

static bfdev_notifier_ret_t
func(void *arg, void *pdata)
Expand All @@ -30,25 +30,25 @@ main(int argc, const char *argv[])
node[0].entry = func;
node[0].pdata = "priority=3";

retval = bfdev_notifier_register(&notifer, &node[0]);
retval = bfdev_notifier_register(&notifier, &node[0]);
if (retval)
return retval;

node[1].priority = 2;
node[1].entry = func;
node[1].pdata = "priority=2";

retval = bfdev_notifier_register(&notifer, &node[1]);
retval = bfdev_notifier_register(&notifier, &node[1]);
if (retval)
return retval;

node[2].priority = 1;
node[2].entry = func;
node[2].pdata = "priority=1";

retval = bfdev_notifier_register(&notifer, &node[2]);
retval = bfdev_notifier_register(&notifier, &node[2]);
if (retval)
return retval;

return bfdev_notifier_call(&notifer, "helloworld", -1, NULL);
return bfdev_notifier_call(&notifier, "helloworld", -1, NULL);
}
4 changes: 2 additions & 2 deletions include/bfdev/array.h
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,7 @@ bfdev_array_size(const bfdev_array_t *array)
static inline bfdev_size_t
bfdev_array_remain(const bfdev_array_t *array)
{
if (array->index <= array->seek)
if (bfdev_unlikely(array->index <= array->seek))
return 0;

return bfdev_array_offset(array, array->index - array->seek);
Expand Down Expand Up @@ -246,7 +246,7 @@ bfdev_array_splice(bfdev_array_t *array, unsigned long index,
* @num: the minimum required free space.
*
* Ensure that the buffer has space allocated for at least
* @num bytes. If the current buffer is too small, it will
* @num elements. If the current buffer is too small, it will
* be reallocated, possibly to a larger size than requested.
*
* Return 0 on success or a negative error code on failure.
Expand Down
2 changes: 1 addition & 1 deletion include/bfdev/glob.h
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
BFDEV_BEGIN_DECLS

extern bfdev_bool
bfdev_glob(const char *patten, const char *string);
bfdev_glob(const char *pattern, const char *string);

BFDEV_END_DECLS

Expand Down
1 change: 1 addition & 0 deletions include/bfdev/skiplist.h
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,7 @@ bfdev_skiplist_delete(bfdev_skip_head_t *head, bfdev_find_t find, void *pdata);
extern void
bfdev_skiplist_reset(bfdev_skip_head_t *head,
bfdev_release_t release, void *pdata);

/**
* bfdev_skiplist_create - create a skiplist header.
* @alloc: the allocator for this skiplist.
Expand Down
1 change: 0 additions & 1 deletion include/bfdev/template/array.h
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,6 @@ bfdev_array_append_buff(bfdev_array_t *array, bfdev_buff_t *append);
extern int
bfdev_array_append_cstr(bfdev_array_t *array, const char *append);


/**
* bfdev_array_append_char() - append char into the array.
* @array: the array object.
Expand Down
18 changes: 9 additions & 9 deletions src/glob.c
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
#include <export.h>

export bfdev_bool
bfdev_glob(const char *patten, const char *string)
bfdev_glob(const char *pattern, const char *string)
{
const char *class, *bpatten, *bstring;
char ptch, stch, tcha, tchb;
Expand All @@ -18,7 +18,7 @@ bfdev_glob(const char *patten, const char *string)
bstring = BFDEV_NULL;

for (;;) {
ptch = *patten++;
ptch = *pattern++;
stch = *string++;

switch (ptch) {
Expand All @@ -28,16 +28,16 @@ bfdev_glob(const char *patten, const char *string)
break;

case '*':
if (*patten == '\0')
if (*pattern == '\0')
return bfdev_true;
bpatten = patten;
bpatten = pattern;
bstring = --string;
break;

case '[':
match = bfdev_false;
inverted = *patten == '!';
class = patten + inverted;
inverted = *pattern == '!';
class = pattern + inverted;
tcha = *class++;

do {
Expand All @@ -57,11 +57,11 @@ bfdev_glob(const char *patten, const char *string)
if (match == inverted)
goto backtrack;

patten = class;
pattern = class;
break;

case '\\':
ptch = *patten++;
ptch = *pattern++;
bfdev_fallthrough;

default: literal:
Expand All @@ -75,7 +75,7 @@ bfdev_glob(const char *patten, const char *string)
if (stch == '\0' || !bpatten)
return bfdev_false;

patten = bpatten;
pattern = bpatten;
string = ++bstring;
break;
}
Expand Down
2 changes: 1 addition & 1 deletion src/libc/xfprintf.c
100755 → 100644
Original file line number Diff line number Diff line change
Expand Up @@ -159,7 +159,7 @@ union vxprintf_arg {
};

static const char
vxprintf_xdigits[16] = {
vxprintf_xdigits[] = {
"0123456789ABCDEF"
};

Expand Down
2 changes: 1 addition & 1 deletion src/refcount-debug.c
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ bfdev_refcnt_report(bfdev_refcnt_t *ref, bfdev_refcnt_saturation_t type)
break;

default:
bfdev_log_err("(%p) unknow error\n", ref);
bfdev_log_err("(%p) unknown error\n", ref);
return;
}
}
8 changes: 4 additions & 4 deletions template/array.c
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ bfdev_array_append_array(bfdev_array_t *array, const bfdev_array_t *append)
{
int retval;

if (array->cells != append->cells)
if (bfdev_unlikely(array->cells != append->cells))
return -BFDEV_EPROTO;

retval = bfdev_array_append(array, append->data, bfdev_array_size(append));
Expand All @@ -28,7 +28,7 @@ bfdev_array_append_buff(bfdev_array_t *array, bfdev_buff_t *append)
{
int retval;

if (array->cells != BFDEV_BYTES_PER_U8)
if (bfdev_unlikely(array->cells != BFDEV_BYTES_PER_U8))
return -BFDEV_EPROTO;

retval = bfdev_array_append(array, append->data, append->len);
Expand All @@ -43,7 +43,7 @@ bfdev_array_append_cstr(bfdev_array_t *array, const char *append)
{
int retval;

if (array->cells != sizeof(*append))
if (bfdev_unlikely(array->cells != sizeof(*append)))
return -BFDEV_EPROTO;

retval = bfdev_array_append(array, append, bfdev_strlen(append));
Expand All @@ -58,7 +58,7 @@ bfdev_array_append_char(bfdev_array_t *array, char append)
{
int retval;

if (array->cells != sizeof(append))
if (bfdev_unlikely(array->cells != sizeof(append)))
return -BFDEV_EPROTO;

retval = bfdev_array_append(array, &append, 1);
Expand Down
1 change: 0 additions & 1 deletion testsuite/bitwalk/fuzzy.c
Original file line number Diff line number Diff line change
Expand Up @@ -326,7 +326,6 @@ TESTSUITE(
return bitwalk_zero(TEST_SMALL_SIZE, TEST_SMALL_LOOP);
}


TESTSUITE(
"bitwalk:zero_large", NULL, NULL,
"bitwalk zero large test"
Expand Down
4 changes: 2 additions & 2 deletions testsuite/testsuite.c
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ options[] = {
{"version", no_argument, 0, 'v'},
{"help", no_argument, 0, 'h'},
{"count", required_argument, 0, 'c'},
{"slient", required_argument, 0, 's'},
{"silent", required_argument, 0, 's'},
{ }, /* NULL */
};

Expand Down Expand Up @@ -187,7 +187,7 @@ usage(void)

bfdev_log_err("Mandatory arguments to long options are mandatory for short options too.\n");
bfdev_log_err(" -c, --count=NUM number of repetitions for each test\n");
bfdev_log_err(" -s, --slient do not print debugging information\n");
bfdev_log_err(" -s, --silent do not print debugging information\n");
bfdev_log_err("\n");

align = 0;
Expand Down
Loading