Initial SETUP.

This commit is contained in:
Christopher Meng 2013-06-30 14:01:10 +08:00
parent bd3a40342c
commit 53b245ea3a
4 changed files with 464 additions and 0 deletions

1
.gitignore vendored
View File

@ -0,0 +1 @@
/v1.9.8.tar.gz

View File

@ -0,0 +1 @@
5a893cda95fec662b3da838b54076507 v1.9.8.tar.gz

View File

@ -0,0 +1,417 @@
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

45
uthash.spec Normal file
View File

@ -0,0 +1,45 @@
Name: uthash
Version: 1.9.8
Release: 3%{?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
Patch0: uthash-remove-failed-tests.patch
BuildArch: noarch
Provides: %{name}-devel = %{version}-%{release}
%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.
%prep
%setup -q
%patch0 -p1
%build
%install
install -d %{buildroot}%{_includedir}
cp -pa src/*.h %{buildroot}%{_includedir}/
%check
cd tests
make %{?_smp_mflags}
%files
%doc LICENSE doc/*.txt
%{_includedir}/ut*.h
%changelog
* Sat Jun 15 2013 Christopher Meng <rpm@cicku.me> - 1.9.8-3
- Add virtual provide.
- Remove 2 wrong tests.
* Fri Jun 14 2013 Christopher Meng <rpm@cicku.me> - 1.9.8-2
- Remove unneeded BR and make files section more clear.
* Sat Jun 01 2013 Christopher Meng <rpm@cicku.me> - 1.9.8-1
- Initial Package.