Skip to content
Snippets Groups Projects
Commit b9bd1104 authored by Safae Kissami's avatar Safae Kissami
Browse files

Merge remote-tracking branch 'fichier/main' into main

parents 36e8ff72 5214c939
Branches main
No related tags found
No related merge requests found
......@@ -36,11 +36,12 @@ int htbl_add(hash_tbl htbl, void* x){
return 0;
}
int htbl_in(hash_tbl htbl, void* x){
void* htbl_in(hash_tbl htbl, void* x){
if(list_in(htbl->array[htbl->h(x)], x, htbl->eq) != NULL)
return x;
return NULL;
}
void htbl_destroy(hash_tbl htbl){
......
......@@ -18,7 +18,7 @@ hash_tbl htbl_empty(size_t (*h)(void*),
int (*eq)(void*, void*),
void (*free)(void*));
int htbl_add(hash_tbl, void*);
int htbl_in(hash_tbl, void*);
void* htbl_in(hash_tbl, void*);
void htbl_destroy(hash_tbl);
#endif
......
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <assert.h>
#include "hash_tbl.h"
......@@ -54,8 +55,8 @@ void test_in() {
}
void test_destroy() {
char a[] = "Coucou 1";
char b[] = "Coucou 2";
char* a = strdup("Coucou 1");
char* b = strdup("Coucou 2");
hash_tbl htbl = htbl_empty(&hash, &eq, &free);
htbl_add(htbl, a);
htbl_add(htbl, b);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment