Skip to content

Commit

Permalink
Update libmaxminddb and MySQL 5.7 (#2192)
Browse files Browse the repository at this point in the history
* Update libmaxminddb and MySQL 5.7 (linux checkout)

* Bump libmaxminddb version

* Typo fix
  • Loading branch information
accelerator74 authored Nov 2, 2024
1 parent 34ddf6d commit 932010e
Show file tree
Hide file tree
Showing 8 changed files with 191 additions and 110 deletions.
8 changes: 5 additions & 3 deletions extensions/geoip/data-pool.c
Original file line number Diff line number Diff line change
@@ -1,12 +1,14 @@
#ifndef _POSIX_C_SOURCE
#define _POSIX_C_SOURCE 200809L
#endif

#include "data-pool.h"
#include "maxminddb.h"

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

static bool can_multiply(size_t const, size_t const, size_t const);

// Allocate an MMDB_data_pool_s. It initially has space for size
// MMDB_entry_data_list_s structs.
MMDB_data_pool_s *data_pool_new(size_t const size) {
Expand Down Expand Up @@ -39,7 +41,7 @@ MMDB_data_pool_s *data_pool_new(size_t const size) {
// the given max. max will typically be SIZE_MAX.
//
// We want to know if we'll wrap around.
static bool can_multiply(size_t const max, size_t const m, size_t const n) {
bool can_multiply(size_t const max, size_t const m, size_t const n) {
if (m == 0) {
return false;
}
Expand Down
1 change: 1 addition & 0 deletions extensions/geoip/data-pool.h
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ typedef struct MMDB_data_pool_s {
MMDB_entry_data_list_s *blocks[DATA_POOL_NUM_BLOCKS];
} MMDB_data_pool_s;

bool can_multiply(size_t const, size_t const, size_t const);
MMDB_data_pool_s *data_pool_new(size_t const);
void data_pool_destroy(MMDB_data_pool_s *const);
MMDB_entry_data_list_s *data_pool_alloc(MMDB_data_pool_s *const);
Expand Down
8 changes: 4 additions & 4 deletions extensions/geoip/maxminddb-compat-util.h
Original file line number Diff line number Diff line change
Expand Up @@ -42,9 +42,9 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*/
static void *
static const void *
mmdb_memmem(const void *l, size_t l_len, const void *s, size_t s_len) {
register char *cur, *last;
const char *cur, *last;
const char *cl = (const char *)l;
const char *cs = (const char *)s;

Expand All @@ -61,9 +61,9 @@ mmdb_memmem(const void *l, size_t l_len, const void *s, size_t s_len) {
return memchr(l, (int)*cs, l_len);

/* the last position where its possible to find "s" in "l" */
last = (char *)cl + l_len - s_len;
last = cl + l_len - s_len;

for (cur = (char *)cl; cur <= last; cur++)
for (cur = cl; cur <= last; cur++)
if (cur[0] == cs[0] && memcmp(cur, cs, s_len) == 0)
return cur;

Expand Down
Loading

0 comments on commit 932010e

Please sign in to comment.