Update to new upstream release v2.0.1

Introduce libut / libvector
This commit is contained in:
Björn Esser 2016-12-17 15:24:49 +01:00
parent fd1834ce0c
commit 94908f987a
4 changed files with 86 additions and 448 deletions

1
.gitignore vendored
View File

@ -1,2 +1,3 @@
/v1.9.8.tar.gz
/uthash-1.9.9.tar.gz
/uthash-2.0.1.tar.gz

View File

@ -1 +1 @@
c3ce9197c818dcb7ca85b59912f310a4 uthash-1.9.9.tar.gz
SHA512 (uthash-2.0.1.tar.gz) = 56463a5600d1ae8ad59f58a4dec9090a4e9b2aa98cb6d24e64c60c5ece63b77f4845b25915c6a179ef890671258854d500fc8a58a1c5a9ba247de7ce8757d423

View File

@ -1,417 +0,0 @@
From c3aef1064b79db79c0982cc92f8f993ace8e3cc6 Mon Sep 17 00:00:00 2001
From: "Troy D. Hanson" <tdh@tkhanson.net>
Date: Mon, 15 Apr 2013 22:36:12 -0400
Subject: [PATCH] Clean up warnings and rm tests w/32-64 variance
---
tests/Makefile | 2 +-
tests/hashscan.c | 1 +
tests/test74.c | 2 +-
tests/test75.c | 2 +-
tests/test76.c | 2 +-
tests/test77.c | 2 +-
tests/test83.ans | 51 ---------------------------------------------------
tests/test83.c | 35 -----------------------------------
tests/test83.dat | 51 ---------------------------------------------------
tests/test84.ans | 51 ---------------------------------------------------
tests/test84.c | 36 ------------------------------------
tests/test84.dat | 51 ---------------------------------------------------
12 files changed, 6 insertions(+), 280 deletions(-)
delete mode 100644 tests/test83.ans
delete mode 100644 tests/test83.c
delete mode 100644 tests/test83.dat
delete mode 100644 tests/test84.ans
delete mode 100644 tests/test84.c
delete mode 100644 tests/test84.dat
diff --git a/tests/Makefile b/tests/Makefile
index b887c95..1d7cb7e 100644
--- a/tests/Makefile
+++ b/tests/Makefile
@@ -13,7 +13,7 @@ PROGS = test1 test2 test3 test4 test5 test6 test7 test8 test9 \
test58 test59 test60 test61 test62 test63 test64 test65 \
test66 test67 test68 test69 test70 test71 test72 test73 \
test74 test75 test76 test77 test78 test79 test80 test81 \
- test82 test83 test84
+ test82
CFLAGS = -I$(HASHDIR)
#CFLAGS += -DHASH_BLOOM=16
#CFLAGS += -O2
diff --git a/tests/hashscan.c b/tests/hashscan.c
index 65c53ae..ea6c5ff 100644
--- a/tests/hashscan.c
+++ b/tests/hashscan.c
@@ -86,6 +86,7 @@ int infer_hash_function(char *key, size_t keylen, uint32_t hashv) {
HASH_FNV(key,keylen,num_bkts,ohashv,obkt); if (ohashv == hashv) return FNV;
HASH_OAT(key,keylen,num_bkts,ohashv,obkt); if (ohashv == hashv) return OAT;
HASH_MUR(key,keylen,num_bkts,ohashv,obkt); if (ohashv == hashv) return MUR;
+ obkt++; // this quiets an unused variable warning. yes, this is a ugly hack
return 0;
}
diff --git a/tests/test74.c b/tests/test74.c
index 549bbb2..4910488 100644
--- a/tests/test74.c
+++ b/tests/test74.c
@@ -32,7 +32,7 @@ int main() {
V_FindCnt++;
}
} while (V_FindPos >= 0);
- printf("FindCnt=%u\n", V_FindCnt);
+ printf("FindCnt=%u\n", (unsigned)V_FindCnt);
utstring_free(s);
utstring_free(t);
diff --git a/tests/test75.c b/tests/test75.c
index d486934..d7520f5 100644
--- a/tests/test75.c
+++ b/tests/test75.c
@@ -32,7 +32,7 @@ int main() {
V_FindCnt++;
}
} while (V_FindPos >= 0);
- printf("FindCnt=%u\n", V_FindCnt);
+ printf("FindCnt=%u\n", (unsigned)V_FindCnt);
utstring_free(s);
utstring_free(t);
diff --git a/tests/test76.c b/tests/test76.c
index 385046f..d975978 100644
--- a/tests/test76.c
+++ b/tests/test76.c
@@ -42,7 +42,7 @@ int main() {
}
printf("utstring_find()=%ld\n", V_FindPos);
} while (V_FindPos >= 0);
- printf("FindCnt=%u\n", V_FindCnt);
+ printf("FindCnt=%u\n", (unsigned)V_FindCnt);
free(V_KMP_Table);
}
diff --git a/tests/test77.c b/tests/test77.c
index 42054b3..5d74942 100644
--- a/tests/test77.c
+++ b/tests/test77.c
@@ -41,7 +41,7 @@ int main() {
}
printf("utstring_find()=%ld\n", V_FindPos);
} while (V_FindPos >= 0);
- printf("FindCnt=%u\n", V_FindCnt);
+ printf("FindCnt=%u\n", (unsigned)V_FindCnt);
free(V_KMP_Table);
}
diff --git a/tests/test83.ans b/tests/test83.ans
deleted file mode 100644
index 666b752..0000000
--- a/tests/test83.ans
+++ /dev/null
@@ -1,51 +0,0 @@
-items in hash: 1, overhead: 460
-items in hash: 2, overhead: 492
-items in hash: 3, overhead: 524
-items in hash: 4, overhead: 556
-items in hash: 5, overhead: 588
-items in hash: 6, overhead: 620
-items in hash: 7, overhead: 652
-items in hash: 8, overhead: 684
-items in hash: 9, overhead: 716
-items in hash: 10, overhead: 748
-items in hash: 11, overhead: 780
-items in hash: 12, overhead: 812
-items in hash: 13, overhead: 844
-items in hash: 14, overhead: 876
-items in hash: 15, overhead: 908
-items in hash: 16, overhead: 940
-items in hash: 17, overhead: 972
-items in hash: 18, overhead: 1004
-items in hash: 19, overhead: 1036
-items in hash: 20, overhead: 1068
-items in hash: 21, overhead: 1100
-items in hash: 22, overhead: 1132
-items in hash: 23, overhead: 1164
-items in hash: 24, overhead: 1196
-items in hash: 25, overhead: 1228
-items in hash: 26, overhead: 1260
-items in hash: 27, overhead: 1292
-items in hash: 28, overhead: 1324
-items in hash: 29, overhead: 1356
-items in hash: 30, overhead: 1388
-items in hash: 31, overhead: 1420
-items in hash: 32, overhead: 1452
-items in hash: 33, overhead: 1484
-items in hash: 34, overhead: 1516
-items in hash: 35, overhead: 1548
-items in hash: 36, overhead: 1580
-items in hash: 37, overhead: 1612
-items in hash: 38, overhead: 1644
-items in hash: 39, overhead: 1676
-items in hash: 40, overhead: 1708
-items in hash: 41, overhead: 1740
-items in hash: 42, overhead: 1772
-items in hash: 43, overhead: 1804
-items in hash: 44, overhead: 1836
-items in hash: 45, overhead: 1868
-items in hash: 46, overhead: 1900
-items in hash: 47, overhead: 1932
-items in hash: 48, overhead: 1964
-items in hash: 49, overhead: 1996
-items in hash: 50, overhead: 2028
-items in hash: 51, overhead: 2060
diff --git a/tests/test83.c b/tests/test83.c
deleted file mode 100644
index 5d458e2..0000000
--- a/tests/test83.c
+++ /dev/null
@@ -1,35 +0,0 @@
-#include "uthash.h"
-#include <stdlib.h> /* malloc */
-#include <errno.h> /* perror */
-#include <stdio.h> /* printf */
-
-#define BUFLEN 20
-
-typedef struct name_rec {
- char boy_name[BUFLEN];
- UT_hash_handle hh;
-} name_rec;
-
-int main(int argc,char *argv[]) {
- name_rec *name, *names=NULL;
- char linebuf[BUFLEN];
- FILE *file;
-
- if ( (file = fopen( "test83.dat", "r" )) == NULL ) {
- perror("can't open: ");
- exit(-1);
- }
-
- while (fgets(linebuf,BUFLEN,file) != NULL) {
- if ( (name = (name_rec*)malloc(sizeof(name_rec))) == NULL) exit(-1);
- strncpy(name->boy_name,linebuf,BUFLEN);
- HASH_ADD_STR(names,boy_name,name);
- printf("items in hash: %u, overhead: %u\n",(unsigned)HASH_COUNT(names),
- (unsigned)HASH_OVERHEAD(hh,names));
- }
-
- fclose(file);
-
- return 0;
-}
-
diff --git a/tests/test83.dat b/tests/test83.dat
deleted file mode 100644
index bb6051b..0000000
--- a/tests/test83.dat
+++ /dev/null
@@ -1,51 +0,0 @@
-JOHN
-WILLIAM
-WALTER
-DOUGLAS
-GERALD
-FREDERICK
-WARREN
-SHANE
-LESTER
-RON
-HARVEY
-ADRIAN
-CODY
-NELSON
-CLIFTON
-WILLARD
-DOUG
-ORLANDO
-REX
-OMAR
-DAMON
-LOWELL
-IRVING
-CARROLL
-LAURENCE
-ROLANDO
-CARY
-XAVIER
-ISAIAH
-GUS
-JARVIS
-WINFRED
-RAYMUNDO
-LINCOLN
-CORNELL
-NIGEL
-NORMAND
-FRITZ
-DONN
-TRINIDAD
-ODIS
-DANNIE
-DARIO
-KENTON
-CHONG
-NEVILLE
-TONEY
-WARNER
-WES
-COLTON
-ARNOLDO
diff --git a/tests/test84.ans b/tests/test84.ans
deleted file mode 100644
index 7b3cc1e..0000000
--- a/tests/test84.ans
+++ /dev/null
@@ -1,51 +0,0 @@
-items in hash: 1, overhead: 8664
-items in hash: 2, overhead: 8696
-items in hash: 3, overhead: 8728
-items in hash: 4, overhead: 8760
-items in hash: 5, overhead: 8792
-items in hash: 6, overhead: 8824
-items in hash: 7, overhead: 8856
-items in hash: 8, overhead: 8888
-items in hash: 9, overhead: 8920
-items in hash: 10, overhead: 8952
-items in hash: 11, overhead: 8984
-items in hash: 12, overhead: 9016
-items in hash: 13, overhead: 9048
-items in hash: 14, overhead: 9080
-items in hash: 15, overhead: 9112
-items in hash: 16, overhead: 9144
-items in hash: 17, overhead: 9176
-items in hash: 18, overhead: 9208
-items in hash: 19, overhead: 9240
-items in hash: 20, overhead: 9272
-items in hash: 21, overhead: 9304
-items in hash: 22, overhead: 9336
-items in hash: 23, overhead: 9368
-items in hash: 24, overhead: 9400
-items in hash: 25, overhead: 9432
-items in hash: 26, overhead: 9464
-items in hash: 27, overhead: 9496
-items in hash: 28, overhead: 9528
-items in hash: 29, overhead: 9560
-items in hash: 30, overhead: 9592
-items in hash: 31, overhead: 9624
-items in hash: 32, overhead: 9656
-items in hash: 33, overhead: 9688
-items in hash: 34, overhead: 9720
-items in hash: 35, overhead: 9752
-items in hash: 36, overhead: 9784
-items in hash: 37, overhead: 9816
-items in hash: 38, overhead: 9848
-items in hash: 39, overhead: 9880
-items in hash: 40, overhead: 9912
-items in hash: 41, overhead: 9944
-items in hash: 42, overhead: 9976
-items in hash: 43, overhead: 10008
-items in hash: 44, overhead: 10040
-items in hash: 45, overhead: 10072
-items in hash: 46, overhead: 10104
-items in hash: 47, overhead: 10136
-items in hash: 48, overhead: 10168
-items in hash: 49, overhead: 10200
-items in hash: 50, overhead: 10232
-items in hash: 51, overhead: 10264
diff --git a/tests/test84.c b/tests/test84.c
deleted file mode 100644
index 92f0749..0000000
--- a/tests/test84.c
+++ /dev/null
@@ -1,36 +0,0 @@
-#define HASH_BLOOM 16
-#include "uthash.h"
-#include <stdlib.h> /* malloc */
-#include <errno.h> /* perror */
-#include <stdio.h> /* printf */
-
-#define BUFLEN 20
-
-typedef struct name_rec {
- char boy_name[BUFLEN];
- UT_hash_handle hh;
-} name_rec;
-
-int main(int argc,char *argv[]) {
- name_rec *name, *names=NULL;
- char linebuf[BUFLEN];
- FILE *file;
-
- if ( (file = fopen( "test84.dat", "r" )) == NULL ) {
- perror("can't open: ");
- exit(-1);
- }
-
- while (fgets(linebuf,BUFLEN,file) != NULL) {
- if ( (name = (name_rec*)malloc(sizeof(name_rec))) == NULL) exit(-1);
- strncpy(name->boy_name,linebuf,BUFLEN);
- HASH_ADD_STR(names,boy_name,name);
- printf("items in hash: %u, overhead: %u\n",(unsigned)HASH_COUNT(names),
- (unsigned)HASH_OVERHEAD(hh,names));
- }
-
- fclose(file);
-
- return 0;
-}
-
diff --git a/tests/test84.dat b/tests/test84.dat
deleted file mode 100644
index bb6051b..0000000
--- a/tests/test84.dat
+++ /dev/null
@@ -1,51 +0,0 @@
-JOHN
-WILLIAM
-WALTER
-DOUGLAS
-GERALD
-FREDERICK
-WARREN
-SHANE
-LESTER
-RON
-HARVEY
-ADRIAN
-CODY
-NELSON
-CLIFTON
-WILLARD
-DOUG
-ORLANDO
-REX
-OMAR
-DAMON
-LOWELL
-IRVING
-CARROLL
-LAURENCE
-ROLANDO
-CARY
-XAVIER
-ISAIAH
-GUS
-JARVIS
-WINFRED
-RAYMUNDO
-LINCOLN
-CORNELL
-NIGEL
-NORMAND
-FRITZ
-DONN
-TRINIDAD
-ODIS
-DANNIE
-DARIO
-KENTON
-CHONG
-NEVILLE
-TONEY
-WARNER
-WES
-COLTON
-ARNOLDO
--
1.8.1.6

View File

@ -1,53 +1,107 @@
# This package builds a header-only lib, but has some testsuite to check
# the headers' function. For this reason the main-pkg is build arched and
# produces a noarched subpkg, only. There is no binary-compiled bits and
# therefore no debuginfo generated.
%global debug_package %{nil}
%global sover 0
Name: uthash
Version: 1.9.9
Release: 10%{?dist}
Summary: A hash table for C structures
License: BSD
URL: http://troydhanson.github.io/uthash
Source0: https://github.com/troydhanson/%{name}/archive/v%{version}.tar.gz#/%{name}-%{version}.tar.gz
%global common_desc \
Any C structure can be stored in a hash table using uthash. Just \
add a UT_hash_handle to the structure and choose one or more fields \
in your structure to act as the key. Then use these macros to store, \
retrieve or delete items from the hash table.
Name: uthash
Version: 2.0.1
Release: 1%{?dist}
Summary: A hash table for C structures
License: BSD
URL: http://troydhanson.github.io/uthash
Source0: https://github.com/troydhanson/%{name}/archive/v%{version}.tar.gz#/%{name}-%{version}.tar.gz
%description
Any C structure can be stored in a hash table using uthash. Just add a
UT_hash_handle to the structure and choose one or more fields in your
structure to act as the key. Then use these macros to store, retrieve or
delete items from the hash table.
%{common_desc}
%package devel
Summary: A hash table for C structures (headers only)
Provides: %{name}-static = %{version}-%{release}
BuildArch: noarch
%package devel
Summary: A hash table for C structures (headers only)
Provides: %{name}-static == %{version}-%{release}
BuildArch: noarch
%description devel
Any C structure can be stored in a hash table using uthash. Just add a
UT_hash_handle to the structure and choose one or more fields in your
structure to act as the key. Then use these macros to store, retrieve or
delete items from the hash table.
%{common_desc}
%package -n libut
Summary: Library-implementation of utvector
%description -n libut
The utvector is an alternative to utarray. It is a bit more
efficient. It's object code, not just a header.
%package -n libut-devel
Summary: Development-files for libut
Requires: %{name}-devel == %{version}-%{release}
Requires: libut%{?_isa} == %{version}-%{release}
%description -n libut-devel
Development-files for libut.
%prep
%setup -q
%autosetup
%build
# This is a header only package.
%configure || :
export CFLAGS="-fPIC ${CFLAGS}"
%make_build -C libut
%{__cc} -shared ${CFLAGS} ${LDFLAGS} \
-Wl,-soname,libut.so.%{sover} \
-o libut/libut.so.%{sover} libut/*.o
%install
install -d %{buildroot}%{_includedir}
install -pm0644 src/*.h %{buildroot}%{_includedir}/
%{__mkdir} -p %{buildroot}%{_includedir} \
%{buildroot}%{_libdir}
%{__install} -pm 0644 src/*.h %{buildroot}%{_includedir}
%{__install} -pm 0755 libut/libut.so.0 %{buildroot}%{_libdir}
/bin/ln -s %{_libdir}/libut.so.0 %{buildroot}%{_libdir}/libut.so
%check
%make_build -C tests/
%configure || :
%make_build -C tests
%make_build -C libut/tests
%post -n libut -p /sbin/ldconfig
%postun -n libut -p /sbin/ldconfig
%files devel
%doc doc/*.txt
%license LICENSE
%doc doc/*.txt
%exclude %{_includedir}/utvector.h
%{_includedir}/ut*.h
%files -n libut
%license LICENSE
%{_libdir}/libut.so.%{sover}
%files -n libut-devel
%doc libut/README.md
%{_includedir}/libut.h
%{_includedir}/ringbuf.h
%{_includedir}/utvector.h
%{_libdir}/libut.so
%changelog
* Sat Dec 17 2016 Björn Esser <fedora@besser82.io> - 2.0.1-1
- Update to new upstream release v2.0.1
- Introduce libut / libvector
* Fri Feb 05 2016 Fedora Release Engineering <releng@fedoraproject.org> - 1.9.9-10
- Rebuilt for https://fedoraproject.org/wiki/Fedora_24_Mass_Rebuild