Revision: 611
Author: gtm.daemon
Date: Fri May 3 14:00:17 2013
Log: Fix:Analyzer complains that -[init] causes a call to calloc()
with 0 as the number of bytes, and calloc isn't defined for 0.
DELTA=6 (5 added, 0 deleted, 1 changed)
http://code.google.com/p/google-toolbox-for-mac/source/detail?r=611
Modified:
/trunk/Foundation/GTMLoggerRingBufferWriter.m
=======================================
--- /trunk/Foundation/GTMLoggerRingBufferWriter.m Thu May 26 13:30:19 2011
+++ /trunk/Foundation/GTMLoggerRingBufferWriter.m Fri May 3 14:00:17 2013
@@ -65,7 +65,12 @@
writer_ = [writer retain];
capacity_ = capacity;
- buffer_ = (GTMRingBufferPair *)calloc(capacity_,
sizeof(GTMRingBufferPair));
+ // iVars are initialized to NULL.
+ // Calling calloc with 0 is outside the standard.
+ if (capacity_) {
+ buffer_ = (GTMRingBufferPair *)calloc(capacity_,
+ sizeof(GTMRingBufferPair));
+ }
nextIndex_ = 0;