going less bitfield crazy
authorChristian Grothoff <christian@grothoff.org>
Wed, 6 Apr 2011 07:46:10 +0000 (07:46 +0000)
committerChristian Grothoff <christian@grothoff.org>
Wed, 6 Apr 2011 07:46:10 +0000 (07:46 +0000)
src/datacache/plugin_datacache_sqlite.c
src/include/gnunet_datastore_plugin.h
src/vpn/gnunet-service-dns.c
src/vpn/gnunet-vpn-packet.h

index 0341c76dc4953daab044e8812ebf0cebd37574cb..4c429c1b4576893e8b5a60f84386f49ef77a8447 100644 (file)
@@ -440,6 +440,7 @@ libgnunet_plugin_datacache_sqlite_init (void *cls)
                    "sqlite", _("Sqlite datacache running\n"));
   return api;
 }
+// explain SELECT type FROM gn090 WHERE NOT EXISTS (SELECT 1 from gn090 WHERE expire < 42 LIMIT 1) OR expire < 42 ORDER BY repl DESC, Random() LIMIT 1;
 
 
 /**
index 372ed633cb9433cca693ea9e561fa9085d3d6af0..f499cb82786a767a02bacd1c5b4cd2a1439cc75f 100644 (file)
@@ -169,7 +169,7 @@ typedef int (*PluginPut) (void *cls,
  * in the datastore.
  *
  * @param cls closure
- * @param key maybe NULL (to match all entries)
+ * @param key key to match, never NULL
  * @param vhash hash of the value, maybe NULL (to
  *        match all values that have the right key).
  *        Note that for DBlocks there is no difference
index 944b7ed46ea616e39a9d8889b4087ff7420ec0ba..d4ef371e7756ba86473a4c4746107dafe0331deb 100644 (file)
@@ -75,7 +75,7 @@ static struct answer_packet_list *head;
 static struct answer_packet_list *tail;
 
 /**
- * A structure containing a mapping from network-byte-ordered DNS-id to
+ * A structure containing a mapping from network-byte-ordered DNS-id (16 bit) to
  * some information needed to handle this query
  *
  * It currently allocates at least
@@ -86,12 +86,12 @@ static struct answer_packet_list *tail;
 static struct {
     unsigned valid:1;
     struct GNUNET_SERVER_Client* client;
-    unsigned local_ip:32;
-    unsigned remote_ip:32;
-    unsigned local_port:16;
+    uint32_t local_ip;
+    uint32_t remote_ip;
+    uint16_t local_port;
     char* name;
-    unsigned namelen:8;
-} query_states[65536];
+    uint8_t namelen;
+} query_states[UINT16_MAX];
 
 /**
  * A struct used to give more than one value as
index 51cf4c4e8f3aad120cc0db9c2f6d6df5e822b1aa..87b12cb69fafd3398d5d595bd3208861f78f6f54 100644 (file)
@@ -71,7 +71,7 @@ struct icmp_hdr {
 
 // DNS-Stuff
 struct dns_static {
-       unsigned short id GNUNET_PACKED;
+        uint16_t id GNUNET_PACKED;
 
        unsigned rd:1 GNUNET_PACKED; // recursion desired (client -> server)
        unsigned tc:1 GNUNET_PACKED; // message is truncated
@@ -88,10 +88,10 @@ struct dns_static {
        unsigned z:3 GNUNET_PACKED;  // reserved
        unsigned ra:1 GNUNET_PACKED; // recursion available (server -> client)
 
-       unsigned short qdcount GNUNET_PACKED; // number of questions
-       unsigned short ancount GNUNET_PACKED; // number of answers
-       unsigned short nscount GNUNET_PACKED; // number of authority-records
-       unsigned short arcount GNUNET_PACKED; // number of additional records
+       uint16_t qdcount GNUNET_PACKED; // number of questions
+        uint16_t ancount GNUNET_PACKED; // number of answers
+       uint16_t nscount GNUNET_PACKED; // number of authority-records
+       uint16_t arcount GNUNET_PACKED; // number of additional records
 };
 
 struct dns_pkt {