From b6329757d7263d97c2cdfad5a0df766ad7d2e4a2 Mon Sep 17 00:00:00 2001 From: uz Date: Fri, 9 Mar 2012 11:45:08 +0000 Subject: [PATCH] Export the compare function since it is used in a few places. git-svn-id: svn://svn.cc65.org/cc65/trunk@5583 b7a2c559-68d2-44c3-8de9-860c34a00d81 --- src/common/fileid.c | 6 +++--- src/common/fileid.h | 3 +++ 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/src/common/fileid.c b/src/common/fileid.c index 8e0a875a5..d7a1fcdc8 100644 --- a/src/common/fileid.c +++ b/src/common/fileid.c @@ -48,8 +48,8 @@ -static int Compare (const void* Key, const void* Id) -/* Compare function for bsearch */ +int CompareFileId (const void* Key, const void* Id) +/* Compare function used when calling bsearch with a table of FileIds */ { return strcmp (Key, ((const FileId*) Id)->Ext); } @@ -72,7 +72,7 @@ const FileId* GetFileId (const char* Name, const FileId* Table, unsigned Count) } /* Search for a table entry and return it */ - return bsearch (Ext+1, Table, Count, sizeof (FileId), Compare); + return bsearch (Ext+1, Table, Count, sizeof (FileId), CompareFileId); } diff --git a/src/common/fileid.h b/src/common/fileid.h index 1faf31ef8..649c84844 100644 --- a/src/common/fileid.h +++ b/src/common/fileid.h @@ -61,6 +61,9 @@ struct FileId { +int CompareFileId (const void* Key, const void* Id); +/* Compare function used when calling bsearch with a table of FileIds */ + const FileId* GetFileId (const char* Name, const FileId* Table, unsigned Count); /* Determine the id of the given file by looking at file extension of the name. * The table passed to the function must be sorted alphabetically. If the