Skip to content
Extraits de code Groupes Projets
Valider a8acc46b rédigé par François De Keersmaeker's avatar François De Keersmaeker
Parcourir les fichiers

Switched to submodule for hashmap.c

parent 420da61e
Aucune branche associée trouvée
Aucune étiquette associée trouvée
Aucune requête de fusion associée trouvée
[submodule "hashmap"]
path = hashmap
path = src/hashmap
url = https://github.com/tidwall/hashmap.c
......@@ -11,12 +11,15 @@ IF( CMAKE_CROSSCOMPILING AND DEFINED ENV{STAGING_DIR} )
message(STATUS "Using toolchain file: ${CMAKE_TOOLCHAIN_FILE}")
ENDIF()
# Set project directories
## Set project directories
link_directories($ENV{LD_LIBRARY_PATH})
set(CMAKE_INSTALL_PREFIX ${PROJECT_SOURCE_DIR})
set(INCLUDE_DIR ${PROJECT_SOURCE_DIR}/include)
set(BIN_DIR ${PROJECT_SOURCE_DIR}/bin)
set(LIB_DIR ${PROJECT_SOURCE_DIR}/lib)
set(EXECUTABLE_OUTPUT_PATH ${BIN_DIR})
# Hashmap directory
set(HASHMAP_DIR ${PROJECT_SOURCE_DIR}/src/hashmap)
# Set compiler flags
#add_compile_options(-Wall -Werror -Wno-unused-variable -DDEBUG) # Debug
......
......@@ -8,4 +8,3 @@ add_subdirectory(dlink-cam)
add_subdirectory(philips-hue)
add_subdirectory(smartthings-hub)
add_subdirectory(amazon-echo)
add_subdirectory(example)
\ No newline at end of file
// Copyright 2020 Joshua J Baker. All rights reserved.
// Use of this source code is governed by an MIT-style
// license that can be found in the LICENSE file.
#ifndef HASHMAP_H
#define HASHMAP_H
#include <stdbool.h>
#include <stddef.h>
#include <stdint.h>
typedef struct hashmap hashmap;
struct hashmap *hashmap_new(size_t elsize, size_t cap,
uint64_t seed0, uint64_t seed1,
uint64_t (*hash)(const void *item,
uint64_t seed0, uint64_t seed1),
int (*compare)(const void *a, const void *b,
void *udata),
void (*elfree)(void *item),
void *udata);
struct hashmap *hashmap_new_with_allocator(
void *(*malloc)(size_t),
void *(*realloc)(void *, size_t),
void (*free)(void*),
size_t elsize, size_t cap,
uint64_t seed0, uint64_t seed1,
uint64_t (*hash)(const void *item,
uint64_t seed0, uint64_t seed1),
int (*compare)(const void *a, const void *b,
void *udata),
void (*elfree)(void *item),
void *udata);
void hashmap_free(struct hashmap *map);
void hashmap_clear(struct hashmap *map, bool update_cap);
size_t hashmap_count(struct hashmap *map);
bool hashmap_oom(struct hashmap *map);
void *hashmap_get(struct hashmap *map, const void *item);
void *hashmap_set(struct hashmap *map, const void *item);
void *hashmap_delete(struct hashmap *map, void *item);
void *hashmap_probe(struct hashmap *map, uint64_t position);
bool hashmap_scan(struct hashmap *map,
bool (*iter)(const void *item, void *udata), void *udata);
bool hashmap_iter(struct hashmap *map, size_t *i, void **item);
uint64_t hashmap_sip(const void *data, size_t len,
uint64_t seed0, uint64_t seed1);
uint64_t hashmap_murmur(const void *data, size_t len,
uint64_t seed0, uint64_t seed1);
// DEPRECATED: use `hashmap_new_with_allocator`
void hashmap_set_allocator(void *(*malloc)(size_t), void (*free)(void*));
#endif /* HASHMAP_H */
......@@ -4,8 +4,8 @@ cmake_minimum_required(VERSION 3.20)
# Build libraries
# hashmap
add_library(hashmap STATIC ${INCLUDE_DIR}/hashmap.h hashmap.c)
target_include_directories(hashmap PRIVATE ${INCLUDE_DIR})
add_library(hashmap STATIC ${HASHMAP_DIR}/hashmap.h ${HASHMAP_DIR}/hashmap.c)
target_include_directories(hashmap PRIVATE ${HASHMAP_DIR})
install(TARGETS hashmap DESTINATION ${LIB_DIR})
# SHA256
......
Fichier déplacé
Ce diff est replié.
0% Chargement en cours ou .
You are about to add 0 people to the discussion. Proceed with caution.
Terminez d'abord l'édition de ce message.
Veuillez vous inscrire ou vous pour commenter