Skip to content

Commit

Permalink
replace realloc with ResizeArray macro
Browse files Browse the repository at this point in the history
  • Loading branch information
scrod committed Feb 15, 2011
1 parent 092a06d commit ff8bf19
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 9 deletions.
2 changes: 1 addition & 1 deletion BufferUtils.h
Expand Up @@ -26,7 +26,7 @@
typedef struct _PerDiskInfo {

//index in a table of disk UUIDs; should be the disk from which this time was gathered
//the disk UUIDs table is tracked separately in FrozenNotation; it should only ever be appended-to
//the disk UUIDs table is tracked separately in NotationPrefs; it should only ever be appended-to
UInt32 diskIDIndex;

//catalog node ID of a file
Expand Down
4 changes: 2 additions & 2 deletions NotationController.h
Expand Up @@ -31,9 +31,9 @@ typedef struct _NoteCatalogEntry {
UInt32 logicalSize;
OSType fileType;
UInt32 nodeID;
CFMutableStringRef filename;
unsigned int filenameCharCount;
UniChar *filenameChars;
UniCharCount filenameCharCount;
CFMutableStringRef filename;
} NoteCatalogEntry;

@class NoteObject;
Expand Down
7 changes: 1 addition & 6 deletions NotationDirectoryManager.m
Expand Up @@ -305,12 +305,7 @@ - (BOOL)_readFilesInDirectory {
entry->lastModified = fsCatInfoArray[i].contentModDate;
entry->lastAttrModified = fsCatInfoArray[i].attributeModDate;


if (filename->length > entry->filenameCharCount) {
entry->filenameCharCount = filename->length;
entry->filenameChars = (UniChar*)realloc(entry->filenameChars, entry->filenameCharCount * sizeof(UniChar));
}

ResizeArray(&(entry->filenameChars), filename->length, &(entry->filenameCharCount));
memcpy(entry->filenameChars, filename->unicode, filename->length * sizeof(UniChar));

if (!entry->filename)
Expand Down

0 comments on commit ff8bf19

Please sign in to comment.