Skip to content

Commit

Permalink
Merge ce7f8fd into 2461659
Browse files Browse the repository at this point in the history
  • Loading branch information
iphydf committed Jul 20, 2018
2 parents 2461659 + ce7f8fd commit ef0e3ab
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 10 deletions.
5 changes: 4 additions & 1 deletion auto_tests/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,10 @@ test_sizes = {

[cc_test(
name = src[:-2],
size = test_sizes.get(src[:-2], "small"),
size = test_sizes.get(
src[:-2],
"small",
),
srcs = [src],
copts = ["-Wno-sign-compare"],
deps = [
Expand Down
18 changes: 9 additions & 9 deletions toxcore/list.c
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@

#include "list.h"

#include <stdbool.h>
#include <stdlib.h>
#include <string.h>

Expand Down Expand Up @@ -118,36 +119,35 @@ static int find(const BS_List *list, const uint8_t *data)
}
}

/* Resized the list list
/**
* Resizes the list.
*
* return value:
* 1 : success
* 0 : failure
* @return true on success.
*/
static int resize(BS_List *list, uint32_t new_size)
static bool resize(BS_List *list, uint32_t new_size)
{
if (new_size == 0) {
bs_list_free(list);
return 1;
return true;
}

uint8_t *data = (uint8_t *)realloc(list->data, list->element_size * new_size);

if (!data) {
return 0;
return false;
}

list->data = data;

int *ids = (int *)realloc(list->ids, sizeof(int) * new_size);

if (!ids) {
return 0;
return false;
}

list->ids = ids;

return 1;
return true;
}


Expand Down

0 comments on commit ef0e3ab

Please sign in to comment.