diff options
author | dmaclach <dmaclach@google.com> | 2016-10-07 12:10:23 -0400 |
---|---|---|
committer | Thomas Van Lenten <thomasvl@google.com> | 2016-10-07 12:21:06 -0400 |
commit | 42124b3691197c3c4f52f069775fa0390a8ff942 (patch) | |
tree | ebd373d398ea64b45bdc1d196fa0a2c5f57cabfd /Foundation/GTMRegex.m | |
parent | 57eeab4193210df8ab0c81e9d3f1ee1ad3e24492 (diff) |
First cut at pruning things/updating things.
Remove a bunch of code that Google stopped using/maintaining rather than trying
to update it it. Some would be hard to update, some actually has system provided
replacements; others are patterns that just don't seem as common now.
Prune out the code related to macOS <= 10.5, start pruning some of the really
old iOS support also.
Get the projects mostly limping again with modern Xcodes so tests can be run.
If someone ends up on this commit via history for something they still find
as useful, feel free to do a pull request to bring the snippet of code back to
life and update it for current SDKs.
Diffstat (limited to 'Foundation/GTMRegex.m')
-rw-r--r-- | Foundation/GTMRegex.m | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/Foundation/GTMRegex.m b/Foundation/GTMRegex.m index 238ca48..7ac4665 100644 --- a/Foundation/GTMRegex.m +++ b/Foundation/GTMRegex.m @@ -133,7 +133,7 @@ static NSString *const kReplacementPattern = - (id)initWithPattern:(NSString *)pattern options:(GTMRegexOptions)options withError:(NSError **)outErrorOrNULL { - + self = [super init]; if (!self) return nil; @@ -275,7 +275,7 @@ static NSString *const kReplacementPattern = - (NSString *)firstSubStringMatchedInString:(NSString *)str { NSString *result = nil; - + regmatch_t regMatch; const char *utf8Str = [str UTF8String]; if ([self runRegexOnUTF8:utf8Str @@ -380,7 +380,7 @@ static NSString *const kReplacementPattern = } else { // spin over the split up replacement GTMRegexStringSegment *replacementSegment = nil; - GTM_FOREACH_OBJECT(replacementSegment, replacements) { + for (replacementSegment in replacements) { if (![replacementSegment isMatch]) { // not a match, raw text to put in [result appendString:[replacementSegment string]]; @@ -687,14 +687,14 @@ static NSString *const kReplacementPattern = return nil; // pick off when it wasn't found - if ((regMatches_[patternIndex].rm_so == -1) && + if ((regMatches_[patternIndex].rm_so == -1) && (regMatches_[patternIndex].rm_eo == -1)) return nil; // fetch the string - const char *base = (const char*)[utf8StrBuf_ bytes] + const char *base = (const char*)[utf8StrBuf_ bytes] + regMatches_[patternIndex].rm_so; - regoff_t len = regMatches_[patternIndex].rm_eo + regoff_t len = regMatches_[patternIndex].rm_eo - regMatches_[patternIndex].rm_so; return [[[NSString alloc] initWithBytes:base length:(NSUInteger)len @@ -707,7 +707,7 @@ static NSString *const kReplacementPattern = [self class], self, (isMatch_ ? "YES" : "NO")]; for (NSUInteger x = 0; x <= numRegMatches_; ++x) { int length = (int)(regMatches_[x].rm_eo - regMatches_[x].rm_so); - const char* string + const char* string = (((const char*)[utf8StrBuf_ bytes]) + regMatches_[x].rm_so); if (x == 0) { [result appendFormat:@" \"%.*s\"", length , string]; |