Changeset: 9af90cc1a1e5 for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB/rev/9af90cc1a1e5
Modified Files:
        monetdb5/modules/atoms/url.c
Branch: urlfuncs
Log Message:

remove unnecessary checks to increase speed


diffs (44 lines):

diff --git a/monetdb5/modules/atoms/url.c b/monetdb5/modules/atoms/url.c
--- a/monetdb5/modules/atoms/url.c
+++ b/monetdb5/modules/atoms/url.c
@@ -884,6 +884,14 @@ extractURLHost(str *retval, str *url, bo
 }
 
 
+static inline str
+str_buf_copy(str *buf, size_t *buflen, const char *s, size_t l) {
+       CHECK_STR_BUFFER_LENGTH(buf, buflen, l, "url.str_buf_copy");
+       strcpy_len(*buf, s, l);
+       return MAL_SUCCEED;
+}
+
+
 // bulk version
 static str
 BATextractURLHost(bat *res, const bat *bid, bool no_www)
@@ -940,17 +948,17 @@ BATextractURLHost(bat *res, const bat *b
                                        l = s - host;
                                }
                                if (domain && l > 3) {
-                                       if (no_www && strlen(host) > 4 && 
!strncmp(host, "www.", 4))
+                                       if (no_www && !strncmp(host, "www.", 4))
                                                host += 4;
-                                       if ((msg = str_Sub_String(&buf, 
&buflen, host, 0, l)) != MAL_SUCCEED)
+                                       // if ((msg = str_Sub_String(&buf, 
&buflen, host, 0, l)) != MAL_SUCCEED)
+                                       //      break;
+                                       if ((msg = str_buf_copy(&buf, &buflen, 
host, (size_t) l)) != MAL_SUCCEED)
                                                break;
-                                       if (checkUTF8(buf)) {
-                                               if (bunfastapp_nocheckVAR(bn, 
buf) != GDK_SUCCEED) {
-                                                       msg = 
createException(MAL, "baturl.extractURLHost", SQLSTATE(HY013) MAL_MALLOC_FAIL );
-                                                       break;
-                                               }
-                                               continue;
+                                       if (bunfastapp_nocheckVAR(bn, buf) != 
GDK_SUCCEED) {
+                                               msg = createException(MAL, 
"baturl.extractURLHost", SQLSTATE(HY013) MAL_MALLOC_FAIL );
+                                               break;
                                        }
+                                       continue;
                                }
                        }
                        // fall back insert nil str if no valid host
_______________________________________________
checkin-list mailing list -- checkin-list@monetdb.org
To unsubscribe send an email to checkin-list-le...@monetdb.org

Reply via email to