[darwinbuild-changes] [994] branches/PR-10428083/darwinup/Utils.cpp
source_changes at macosforge.org
source_changes at macosforge.org
Fri Jan 20 23:07:10 PST 2012
Revision: 994
http://trac.macosforge.org/projects/darwinbuild/changeset/994
Author: mww at apple.com
Date: 2012-01-20 23:07:10 -0800 (Fri, 20 Jan 2012)
Log Message:
-----------
Fix has_suffix.
Modified Paths:
--------------
branches/PR-10428083/darwinup/Utils.cpp
Modified: branches/PR-10428083/darwinup/Utils.cpp
===================================================================
--- branches/PR-10428083/darwinup/Utils.cpp 2012-01-21 07:06:49 UTC (rev 993)
+++ branches/PR-10428083/darwinup/Utils.cpp 2012-01-21 07:07:10 UTC (rev 994)
@@ -141,8 +141,11 @@
}
int has_suffix(const char* str, const char* sfx) {
- str = strstr(str, sfx);
- return (str && strcmp(str, sfx) == 0);
+ const char *tmp = str + (strlen(str) - strlen(sfx));
+ if (tmp > str) {
+ return (strcmp(tmp, sfx) == 0);
+ }
+ return false;
}
int exec_with_args(const char** args) {
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.macosforge.org/pipermail/darwinbuild-changes/attachments/20120120/1f41a9f7/attachment-0001.html>
More information about the darwinbuild-changes
mailing list