]> mj.ucw.cz Git - libucw.git/commitdiff
Libucw: Prime numbers moved from lib.h to prime.h.
authorMichal Vaner <vorner@ucw.cz>
Sun, 20 Jul 2008 21:12:25 +0000 (23:12 +0200)
committerMartin Mares <mj@ucw.cz>
Sun, 20 Jul 2008 21:50:09 +0000 (23:50 +0200)
ucw/Makefile
ucw/hashtable.h
ucw/lib.h
ucw/prime.c
ucw/prime.h [new file with mode: 0644]
ucw/primetable.c
ucw/sorter/sort-test.c
ucw/url.c

index 8cd63745ea971f244e249a75be0e5ce8e6b9c0bd..67d974e7edbb7fe30b96d72e6b393015b56922c6 100644 (file)
@@ -43,7 +43,7 @@ LIBUCW_INCLUDES= \
        hashfunc.h hashtable.h \
        heap.h binheap.h binheap-node.h \
        redblack.h \
-       binsearch.h \
+       binsearch.h prime.h \
        bitops.h \
        conf.h getopt.h ipaccess.h \
        profile.h \
index 355f83b4e0f241c28a3104ab44fad698bfd2568d..afccbd06fbf9d3f2ca51c24b3a7f20a79a57c7b6 100644 (file)
 #include "ucw/hashfunc.h"
 #endif
 
+#include "ucw/prime.h"
+
 #include <string.h>
 
 /* Initial setup of parameters */
index 0dad3777b67a58815b26d2bc3ee16b2baaac8868..c473343ce5338af7466ca703c81ad63b091db098 100644 (file)
--- a/ucw/lib.h
+++ b/ucw/lib.h
@@ -148,16 +148,6 @@ void xfree(void *);
 void *xmalloc_zero(uns) LIKE_MALLOC;
 char *xstrdup(const char *) LIKE_MALLOC;
 
-/* prime.c */
-
-int isprime(uns x);
-uns nextprime(uns x);
-
-/* primetable.c */
-
-uns next_table_prime(uns x);
-uns prev_table_prime(uns x);
-
 /* timer.c */
 
 timestamp_t get_timestamp(void);
index 1139aa263f4799a3f886bdedde1daeca019c3ee3..12655492f5c626f1dffc020de8f463b47080a125 100644 (file)
@@ -8,6 +8,7 @@
  */
 
 #include "ucw/lib.h"
+#include "ucw/prime.h"
 
 static int                             /* Sequential search */
 __isprime(uns x)                       /* We know x != 2 && x != 3 */
diff --git a/ucw/prime.h b/ucw/prime.h
new file mode 100644 (file)
index 0000000..9ca2a01
--- /dev/null
@@ -0,0 +1,32 @@
+/*
+ *     The UCW Library -- Prime numbers
+ *
+ *     (c) 2008 Michal Vaner <vorner@ucw.cz>
+ *
+ *     Code taken from ucw/lib.h by:
+ *
+ *     (c) 1997--2008 Martin Mares <mj@ucw.cz>
+ *     (c) 2005 Tomas Valla <tom@ucw.cz>
+ *     (c) 2006 Robert Spalek <robert@ucw.cz>
+ *     (c) 2007 Pavel Charvat <pchar@ucw.cz>
+ *
+ *     This software may be freely distributed and used according to the terms
+ *     of the GNU Lesser General Public License.
+ */
+
+#ifndef _UCW_PRIME_H
+#define _UCW_PRIME_H
+
+#include "ucw/lib.h"
+
+/* prime.c */
+
+int isprime(uns x);
+uns nextprime(uns x);
+
+/* primetable.c */
+
+uns next_table_prime(uns x);
+uns prev_table_prime(uns x);
+
+#endif // _UCW_PRIME_H
index efece4f3a0325c930bb48e84f6f97fb43dab0672..22cc1ec7343c67415751eb95a0c193ca84b1b2d5 100644 (file)
@@ -8,6 +8,7 @@
  */
 
 #include "ucw/lib.h"
+#include "ucw/prime.h"
 #include "ucw/binsearch.h"
 
 /* A table of odd primes, each is about 1.2 times the previous one */
index de9bf9a07ea22f4e507a1afa07850ff445a33e3c..a7515d71f9841514e523def08deae6192c4aa205 100644 (file)
@@ -15,6 +15,7 @@
 #include "ucw/hashfunc.h"
 #include "ucw/md5.h"
 #include "ucw/string.h"
+#include "ucw/prime.h"
 
 #include <stdlib.h>
 #include <stdio.h>
index 75b96b063fc2b890a87a3d93fafdc0b3c6cafedb..8f5073a99721aadef2b1b29526940ee5d58bc8db 100644 (file)
--- a/ucw/url.c
+++ b/ucw/url.c
@@ -19,6 +19,7 @@
 #include "ucw/url.h"
 #include "ucw/chartype.h"
 #include "ucw/conf.h"
+#include "ucw/prime.h"
 
 #include <string.h>
 #include <stdlib.h>