~ubuntu-branches/ubuntu/trusty/gnustep-base/trusty

« back to all changes in this revision

Viewing changes to Headers/Foundation/NSRange.h

Tags: upstream-1.20.0
ImportĀ upstreamĀ versionĀ 1.20.0

Show diffs side-by-side

added added

removed removed

Lines of Context:
228
228
#undef  MIN
229
229
#endif
230
230
 
231
 
#if OS_API_VERSION(GS_API_NONE, GS_API_NONE)
232
 
/**
233
 
 * To be used inside a method for making sure that a range does not specify
234
 
 * anything outside the size of an array/string.  Raises exception if range
235
 
 * extends beyond [0,size).
236
 
 */
237
 
#define GS_RANGE_CHECK(RANGE, SIZE) \
238
 
  if (RANGE.location > SIZE || RANGE.length > (SIZE - RANGE.location)) \
239
 
    [NSException raise: NSRangeException \
240
 
                 format: @"in %s, range { %u, %u } extends beyond size (%u)", \
241
 
                 GSNameFromSelector(_cmd), RANGE.location, RANGE.length, SIZE]
242
 
 
243
 
/** Checks whether INDEX is strictly less than OVER (within C array space). */
244
 
#define CHECK_INDEX_RANGE_ERROR(INDEX, OVER) \
245
 
if (INDEX >= OVER) \
246
 
  [NSException raise: NSRangeException \
247
 
               format: @"in %s, index %d is out of range", \
248
 
               GSNameFromSelector(_cmd), INDEX]
249
 
#endif
250
 
 
251
231
#if     defined(__cplusplus)
252
232
}
253
233
#endif