Revision: 1023
Author: [email protected]
Date: Thu Jan 21 03:59:37 2010
Log: The hashing code knows the lengths of the strings passed in, so can use memEQ()
and memcpy().
http://code.google.com/p/perl-devel-nytprof/source/detail?r=1023

Modified:
 /trunk/NYTProf.xs

=======================================
--- /trunk/NYTProf.xs   Thu Jan 21 03:59:33 2010
+++ /trunk/NYTProf.xs   Thu Jan 21 03:59:37 2010
@@ -566,7 +566,7 @@
     while(NULL != found) {

         if (found->key_len == entry.key_len &&
-        strnEQ(found->key, entry.key, entry.key_len)) {
+        memEQ(found->key, entry.key, entry.key_len)) {
             *retval = found;
             return 0;
         }
@@ -581,7 +581,7 @@
                 e->key_len = entry.key_len;
                 e->key = (char*)safemalloc(sizeof(char) * e->key_len + 1);
                 e->key[e->key_len] = '\0';
-                strncpy(e->key, entry.key, e->key_len);
+                memcpy(e->key, entry.key, e->key_len);
                 found->next_entry = e;
                 *retval = (Hash_entry*)found->next_entry;
                 if (hashtable.last_inserted)
@@ -605,7 +605,7 @@
         e->key_len = entry.key_len;
         e->key = (char*)safemalloc(sizeof(char) * e->key_len + 1);
         e->key[e->key_len] = '\0';
-        strncpy(e->key, entry.key, e->key_len);
+        memcpy(e->key, entry.key, e->key_len);

         *retval =   hashtable.table[h] = e;

-- 
You've received this message because you are subscribed to
the Devel::NYTProf Development User group.

Group hosted at:  http://groups.google.com/group/develnytprof-dev
Project hosted at:  http://perl-devel-nytprof.googlecode.com
CPAN distribution:  http://search.cpan.org/dist/Devel-NYTProf

To post, email:  [email protected]
To unsubscribe, email:  [email protected]

Reply via email to