Changeset: 5d5609708cc4 for MonetDB
URL: http://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=5d5609708cc4
Modified Files:
        clients/src/mapilib/Mapi.mx
Branch: Oct2010
Log Message:

minor clean-up & performance improvement(?): call strlen() only once


diffs (17 lines):

diff -r 39c9a59d11e4 -r 5d5609708cc4 clients/src/mapilib/Mapi.mx
--- a/clients/src/mapilib/Mapi.mx       Sat Dec 25 10:25:17 2010 +0100
+++ b/clients/src/mapilib/Mapi.mx       Sat Dec 25 10:27:35 2010 +0100
@@ -4398,11 +4398,11 @@
                strncpy(hdl->query, query, sz);
                hdl->query[sz] = '\0';
        } else {
-               size_t sz = 512 - strlen(hdl->query);
+               size_t ln = strlen(hdl->query), sz = 512 - ln;
                if (sz > 0) {
                        if (size < sz)
                                sz = size;
-                       hdl->query = realloc(hdl->query, strlen(hdl->query) + 
sz + 1);
+                       hdl->query = realloc(hdl->query, ln + sz + 1);
                        strncat(hdl->query, query, sz);
                }
        }
_______________________________________________
Checkin-list mailing list
[email protected]
http://mail.monetdb.org/mailman/listinfo/checkin-list

Reply via email to