diff options
author | brain <brain@e03df62e-2008-0410-955e-edbf42e46eb7> | 2006-08-06 21:37:26 +0000 |
---|---|---|
committer | brain <brain@e03df62e-2008-0410-955e-edbf42e46eb7> | 2006-08-06 21:37:26 +0000 |
commit | 55cf77459383a2480a6898c99fe0ef00a578f199 (patch) | |
tree | 4d0ef4877878fa536ac54110086293949cf0c8ba /src | |
parent | afb5e20d25f3be6c8854cbd3497ea04b2edf14a5 (diff) |
Change to strrchr when looking for '/'. faster
git-svn-id: http://svn.inspircd.org/repository/trunk/inspircd@4749 e03df62e-2008-0410-955e-edbf42e46eb7
Diffstat (limited to 'src')
-rw-r--r-- | src/socket.cpp | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/src/socket.cpp b/src/socket.cpp index 0ad39701f..dde1b1bae 100644 --- a/src/socket.cpp +++ b/src/socket.cpp @@ -97,9 +97,10 @@ bool MatchCIDR(const char* address, const char* cidr_mask, bool match_with_usern * of the @ symbol in each */ char* address_dupe = strdup(address); char* cidr_dupe = strdup(cidr_mask); - - char* username_mask_pos = strchr(cidr_dupe, '@'); - char* username_addr_pos = strchr(address_dupe, '@'); + + /* Use strchr not strrchr, because its going to be nearer to the left */ + char* username_mask_pos = strrchr(cidr_dupe, '@'); + char* username_addr_pos = strrchr(address_dupe, '@'); /* Both strings have an @ symbol in them */ if (username_mask_pos && username_addr_pos) @@ -142,7 +143,8 @@ bool MatchCIDR(const char* address, const char* cidr_mask, bool match_with_usern in_addr mask_in4; - char* bits_chars = strchr(mask,'/'); + /* Use strrchr for this, its nearer to the right */ + char* bits_chars = strrchr(mask,'/'); if (bits_chars) { |