Skip to content
Browse files

Improving readability in DiffMatchPatchCFUtilities using compound lit…

  • Loading branch information...
1 parent bc3366a commit fed921f1b76d929de925169441c2de0559fb1f39 @JanX2 committed May 28, 2012
Showing with 12 additions and 9 deletions.
  1. +12 −9 DiffMatchPatchCFUtilities.c
View
21 DiffMatchPatchCFUtilities.c
@@ -49,19 +49,21 @@ CFStringRef diff_CFStringCreateFromUnichar(UniChar ch) {
}
CFStringRef diff_CFStringCreateSubstring(CFStringRef text, CFIndex start_index, CFIndex length) {
- CFRange substringRange;
- substringRange.length = length;
- substringRange.location = start_index;
+ CFRange substringRange = {
+ .length = length,
+ .location = start_index,
+ };
CFStringRef substring = CFStringCreateWithSubstring(kCFAllocatorDefault, text, substringRange);
return substring;
}
CFRange diff_RightSubstringRange(CFIndex text_length, CFIndex new_length) {
- CFRange substringRange;
- substringRange.length = new_length;
- substringRange.location = text_length - new_length;
+ CFRange substringRange = {
+ .length = new_length,
+ .location = text_length - new_length,
+ };
return substringRange;
}
@@ -70,9 +72,10 @@ CFStringRef diff_CFStringCreateRightSubstring(CFStringRef text, CFIndex text_len
}
CFRange diff_LeftSubstringRange(CFIndex new_length) {
- CFRange substringRange;
- substringRange.length = new_length;
- substringRange.location = 0;
+ CFRange substringRange = {
+ .length = new_length,
+ .location = 0,
+ };
return substringRange;
}

0 comments on commit fed921f

Please sign in to comment.
Something went wrong with that request. Please try again.