<?xml version="1.0" encoding="UTF-8"?>
<commit>
  <added type="array"/>
  <modified type="array">
    <modified>
      <diff>@@ -1,6 +1,5 @@
 *.o
 *.a
-.tmp*
 core
 vgcore*
 core*</diff>
      <filename>.gitignore</filename>
    </modified>
    <modified>
      <diff>@@ -53,4 +53,3 @@ Ruby binding:
 If you just want to use the C API, download the .tar.gz from:
 
 http://rubyforge.org/frs/?group_id=7925
-</diff>
      <filename>README</filename>
    </modified>
    <modified>
      <diff>@@ -185,28 +185,25 @@ int ht_delete(void *base, va_ht_hash_t va_ht, const char *key, size_t n_key) {
 }
 
 int ht_hash_iterate(void *base, va_ht_hash_t va_ht, void *ctx, 
-    ht_iter_status_t *s, LMC_ITERATOR_P(iter)) {
+    size_t *ofs, LMC_ITERATOR_P(iter)) {
   va_ht_hash_entry_t va_hr;
   ht_hash_entry_t *hr = &amp;lmc_null_node;
   ht_hash_t *ht = base + va_ht;
   size_t k;
   size_t item_c = 0;
   size_t slice_counter = 0;
-  for (k = s-&gt;bucket_ofs; k &lt; LMC_HT_BUCKETS; k++) {
+  for (k = 0; k &lt; LMC_HT_BUCKETS; k++) {
     for (va_hr = ht-&gt;va_buckets[k]; va_hr != 0 &amp;&amp; hr != NULL; 
         va_hr = hr-&gt;va_next) {
       hr = va_hr ? base + va_hr : 0;
-      if (s-&gt;ofs &lt; ++item_c) {
+      if (*ofs &lt; ++item_c) {
         iter(ctx, base + hr-&gt;va_key, base + hr-&gt;va_value);
         if (++slice_counter &gt; 999) {
-          s-&gt;ofs = item_c;
+          *ofs = item_c;
           return 2;
         }
       }
     }
-    ++(s-&gt;bucket_ofs);
-    s-&gt;ofs = 0;
-    item_c = 0;
   }
   return 1;
 }</diff>
      <filename>src/lmc_hashtable.c</filename>
    </modified>
    <modified>
      <diff>@@ -16,11 +16,6 @@ typedef struct {
   va_string_t va_value;
 } ht_hash_entry_t;
 
-typedef struct {
-  size_t ofs;
-  size_t bucket_ofs;
-} ht_iter_status_t;
-
 #define LMC_HT_BUCKETS 20731
 #define LMC_ITERATOR_P(n) int ((n)) \
     (void *ctx, const char *key, const char *value)
@@ -40,7 +35,7 @@ const char *ht_get(void *base, va_ht_hash_t va_ht, const char *key, size_t n_key
     size_t *n_value); 
 int ht_delete(void *base, va_ht_hash_t va_ht, const char *key, size_t n_key);
 int ht_hash_destroy(void *base, va_ht_hash_t ht);
-int ht_hash_iterate(void *base, va_ht_hash_t ht, void *ctx, ht_iter_status_t *s,
+int ht_hash_iterate(void *base, va_ht_hash_t ht, void *ctx, size_t *ofs,
     LMC_ITERATOR_P(iter));
 int ht_random_pair(void *base, va_ht_hash_t va_ht, char **r_key, 
     size_t *n_key, char **r_value, size_t *n_value);</diff>
      <filename>src/lmc_hashtable.h</filename>
    </modified>
    <modified>
      <diff>@@ -32,19 +32,13 @@ lmc_lock_t *lmc_lock_init(const char *ns, int init, lmc_error_t *e) {
   return l;
 }
 
-void lmc_lock_free(lmc_lock_t* l) {
-  if (!l) return;
-  if (l-&gt;sem) { sem_close(l-&gt;sem); }
-  free(l);
-}
-
 int lmc_clear_namespace_lock(const char *ns) {
   char namespace[1024];
   lmc_namespacify(namespace, ns);
   lmc_error_t e;
   lmc_lock_t *l = lmc_lock_init(namespace, 1, &amp;e);
   lmc_lock_repair(l);
-  lmc_lock_free(l);
+  free(l);
   return 1;
 }
 </diff>
      <filename>src/lmc_lock.c</filename>
    </modified>
    <modified>
      <diff>@@ -13,7 +13,6 @@ typedef struct {
 } lmc_lock_t;
 
 lmc_lock_t *lmc_lock_init(const char *namespace, int init, lmc_error_t *e);
-void lmc_lock_free(lmc_lock_t* l);
 int lmc_lock_obtain(const char *where, lmc_lock_t* l, lmc_error_t *e);
 int lmc_lock_obtain_mandatory(const char *where, lmc_lock_t* l, lmc_error_t *e);
 int lmc_lock_release(const char *where, lmc_lock_t* l, lmc_error_t *e);</diff>
      <filename>src/lmc_lock.h</filename>
    </modified>
    <modified>
      <diff>@@ -65,13 +65,13 @@ int local_memcache_drop_namespace(const char *namespace, const char *filename,
   if (force) {
     lmc_lock_t *l = lmc_lock_init((char *)clean_ns, 1, e);
     lmc_lock_repair(l);
-    lmc_lock_free(l);
+    free(l);
     char check_lock_name[1024];
     snprintf((char *)&amp;check_lock_name, 1023, &quot;%s-check&quot;, (char *)clean_ns);
     lmc_lock_t *check_l;
     check_l =  lmc_lock_init(check_lock_name, 1, e);
     lmc_lock_repair(check_l);
-    lmc_lock_free(check_l);
+    free(check_l);
   }
   return 1;
 }
@@ -297,10 +297,10 @@ int local_memcache_random_pair_new(local_memcache_t *lmc,
   char *k;
   char *v;
   if (__local_memcache_random_pair(lmc, &amp;k, n_key, &amp;v, n_value)) {
-    (*r_key) = malloc(*n_key);
-    memcpy((*r_key), k, *n_key);
-    (*r_value) = malloc(*n_value);
-    memcpy((*r_value), v, *n_value);
+    char *new_k = malloc(*n_key);
+    memcpy(new_k, k, *n_key);
+    char *new_v = malloc(*n_value);
+    memcpy(new_v, v, *n_value);
   }
   if (!lmc_unlock_shm_region(&quot;local_memcache_random_pair&quot;, lmc)) return 0;
   return 1;
@@ -339,15 +339,14 @@ int local_memcache_free(local_memcache_t *lmc, lmc_error_t *e) {
   if (!lmc_unlock_shm_region(&quot;local_memcache_free&quot;, lmc)) return 0;
   lmc_shm_destroy(lmc-&gt;shm, e);
   free(lmc-&gt;namespace);
-  lmc_lock_free(lmc-&gt;lock);
-  free(lmc);
+  free(lmc-&gt;lock);
   return r;
 }
 
 int local_memcache_iterate(local_memcache_t *lmc, void *ctx, 
-    ht_iter_status_t *s, LMC_ITERATOR_P(iter)) {
+    size_t *ofs, LMC_ITERATOR_P(iter)) {
   if (!lmc_lock_shm_region(&quot;local_memcache_iterate&quot;, lmc)) return 0;
-  int r = ht_hash_iterate(lmc-&gt;base, lmc-&gt;va_hash, ctx, s, iter);
+  int r = ht_hash_iterate(lmc-&gt;base, lmc-&gt;va_hash, ctx, ofs, iter);
   if (!lmc_unlock_shm_region(&quot;local_memcache_iterate&quot;, lmc)) return 0;
   return r;
 }</diff>
      <filename>src/localmemcache.c</filename>
    </modified>
    <modified>
      <diff>@@ -170,9 +170,7 @@ int local_memcache_free(local_memcache_t *lmc, lmc_error_t *e);
  *
  *   local_memcache_t *lmc;
  *   collector_t c;
- *   ht_iter_status_t s;
- *   memset(s, sizeof(ht_iter_status_t));
- *   local_memcache_iterate(lmc, (void *) &amp;c, &amp;s, my_collect);
+ *   local_memcache_iterate(lmc, (void *) &amp;c, my_collect);
  *
  * The memory pool will be locked while iteration takes place, so try to make
  * sure you can iterate within under 2 seconds otherwise other waiting
@@ -180,7 +178,7 @@ int local_memcache_free(local_memcache_t *lmc, lmc_error_t *e);
  * triggering the automatic recovery.)
  *
  */
-int local_memcache_iterate(local_memcache_t *lmc, void *ctx, ht_iter_status_t *s,
+int local_memcache_iterate(local_memcache_t *lmc, void *ctx, size_t *ofs,
     LMC_ITERATOR_P(iter));
 
 /*</diff>
      <filename>src/localmemcache.h</filename>
    </modified>
    <modified>
      <diff>@@ -322,11 +322,10 @@ static VALUE __LocalMemCache__keys(VALUE d) {
   lmc_ruby_iter_collect_keys data;
   data.ary = r;
   int success = 2;
-  ht_iter_status_t s;
-  memset(&amp;s, 0x0, sizeof(ht_iter_status_t));
+  size_t ofs = 0;
   while (success == 2) {
     success = local_memcache_iterate(get_LocalMemCache(obj), 
-        (void *) &amp;data, &amp;s, lmc_ruby_iter);
+        (void *) &amp;data, &amp;ofs, lmc_ruby_iter);
   }
   if (!success) { return Qnil; }
   return Qnil;
@@ -367,15 +366,13 @@ int lmc_ruby_iter_collect_pairs(void *ctx, const char* key, const char* value) {
 static VALUE __LocalMemCache__each_pair(VALUE d) {
   VALUE obj = rb_ary_entry(d, 0);
   int success = 2;
-  ht_iter_status_t s;
-  memset(&amp;s, 0x0, sizeof(ht_iter_status_t));
   size_t ofs = 0;
   while (success == 2) {
     VALUE r = rb_ary_new();
     lmc_ruby_iter_collect_pairs_t data;
     data.ary = r;
     success = local_memcache_iterate(get_LocalMemCache(obj), 
-        (void *) &amp;data, &amp;s, lmc_ruby_iter_collect_pairs);
+        (void *) &amp;data, &amp;ofs, lmc_ruby_iter_collect_pairs);
     long i;
     for (i = 0; i &lt; RARRAY_LEN(r); i++) {
       rb_yield(RARRAY_PTR(r)[i]);</diff>
      <filename>src/ruby-binding/rblocalmemcache.c</filename>
    </modified>
    <modified>
      <diff>@@ -49,3 +49,13 @@ def measure_time(c, &amp;block)
 end
 
 compare_speed(2_000_000)
+#test_gdbm(2_000_000)
+
+#$stdout.write &quot;ht shm setting x 20000: &quot;
+#tmeasure (2_000_000) { 
+#  v = $lm2.get(&quot;f&quot;).to_i + 1
+#  #puts &quot;v:#{v}&quot;
+#  $lm2.set(&quot;f&quot;, v) 
+#}
+#puts &quot;foo: #{$lm2.get(&quot;f&quot;)}&quot;
+ </diff>
      <filename>src/tests/bench.rb</filename>
    </modified>
    <modified>
      <diff>@@ -53,14 +53,6 @@ describe 'LocalMemCache' do
     ll.random_pair.should.be.nil
   end
 
-  it 'should support iteration' do 
-    s = $lm.size
-    s.should.equal 3
-    c = 0
-    $lm.each_pair {|a,b| c += 1 }
-    s.should.equal c
-  end
-
   it 'should throw an exception when accessing a closed pool' do
     $lm.close
     should.raise(LocalMemCache::MemoryPoolClosed) { $lm.keys }
@@ -95,7 +87,6 @@ describe 'LocalMemCache' do
   end
 
 
-
   it 'should support checking of namespaces' do 
     LocalMemCache.check :namespace =&gt; &quot;test&quot;
   end</diff>
      <filename>src/tests/lmc.rb</filename>
    </modified>
  </modified>
  <removed type="array">
    <removed>
      <filename>src/tests/capi.c</filename>
    </removed>
    <removed>
      <filename>src/tests/capi.sh</filename>
    </removed>
    <removed>
      <filename>src/tests/iter</filename>
    </removed>
    <removed>
      <filename>src/tests/iter.rb</filename>
    </removed>
  </removed>
  <parents type="array">
    <parent>
      <id>4418ff7d869f155c0e1fa949ccfb8ed586c7543c</id>
    </parent>
  </parents>
  <author>
    <name>Sven C. Koehler</name>
    <email>schween@snafu.de</email>
  </author>
  <url>http://github.com/sck/localmemcache/commit/f3b2896da4ab9a150ead75ec1ae95143b51eebb5</url>
  <id>f3b2896da4ab9a150ead75ec1ae95143b51eebb5</id>
  <committed-date>2009-09-25T05:58:06-07:00</committed-date>
  <authored-date>2009-09-25T05:58:06-07:00</authored-date>
  <message>Revert &quot;Integrating Paul Minero's improvements.&quot;

This reverts commit 10ebd8a9ca9a5db1f138b90a207b8d0dd82ac091.</message>
  <tree>ab833f519aeb11609cb6d6e50e5fa0f27174373a</tree>
  <committer>
    <name>Sven C. Koehler</name>
    <email>schween@snafu.de</email>
  </committer>
</commit>
