Main Page | Modules | Alphabetical List | Data Structures | File List | Data Fields | Globals

hash_comp.c

Go to the documentation of this file.
00001 /*
00002 ** Copyright (C) 2006 by Kevin L. Mitchell <klmitch@mit.edu>
00003 **
00004 ** This library is free software; you can redistribute it and/or
00005 ** modify it under the terms of the GNU Library General Public
00006 ** License as published by the Free Software Foundation; either
00007 ** version 2 of the License, or (at your option) any later version.
00008 **
00009 ** This library is distributed in the hope that it will be useful,
00010 ** but WITHOUT ANY WARRANTY; without even the implied warranty of
00011 ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00012 ** Library General Public License for more details.
00013 **
00014 ** You should have received a copy of the GNU Library General Public
00015 ** License along with this library; if not, write to the Free
00016 ** Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
00017 ** MA 02111-1307, USA
00018 **
00019 ** @(#)$Id: hash_comp.c,v 1.1 2006/07/15 18:06:18 klmitch Exp $
00020 */
00028 #include <string.h>
00029 
00030 #include "dbprim.h"
00031 #include "dbprim_int.h"
00032 
00033 RCSTAG("@(#)$Id: hash_comp.c,v 1.1 2006/07/15 18:06:18 klmitch Exp $");
00034 
00035 unsigned long
00036 hash_comp(hash_table_t *table, db_key_t *key1, db_key_t *key2)
00037 {
00038   if (!key1 || !dk_len(key1) || !dk_key(key1) || /* invalid keys? */
00039       !key2 || !dk_len(key2) || !dk_key(key2))
00040     return 1; /* return "no match" */
00041 
00042   /* Compare lengths and keys... */
00043   return dk_len(key1) != dk_len(key2) ||
00044     memcmp(dk_key(key1), dk_key(key2), dk_len(key1));
00045 }

Generated on Sat Jul 15 14:10:33 2006 for DatabasePrimitivesLibrary by  doxygen 1.4.4