"Fossies" - the Fresh Open Source Software Archive

Member "FunctionCheck-3.2.0/src/fcmanager/fc_hash.h" (26 May 2012, 1606 Bytes) of package /linux/privat/old/FunctionCheck-3.2.0.tar.gz:


As a special service "Fossies" has tried to format the requested source page into HTML format using (guessed) C and C++ source code syntax highlighting (style: standard) with prefixed line numbers and code folding option. Alternatively you can here view or download the uninterpreted source code file.

    1 /*
    2  * FunctionCheck profiler
    3  * (C) Copyright 2000-2012 Yannick Perret
    4  * 
    5  *  This program is free software; you can redistribute it and/or
    6  *  modify it under the terms of the GNU General Public License as
    7  *  published by the Free Software Foundation; either version 2 of the
    8  *  License, or (at your option) any later version.
    9  *
   10  *  This program is distributed in the hope that it will be useful,
   11  *  but WITHOUT ANY WARRANTY; without even the implied warranty of
   12  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
   13  *  General Public License for more details.
   14  *
   15  *  You should have received a copy of the GNU General Public License
   16  *  along with this program; if not, write to the Free Software
   17  *  Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
   18  */
   19 /** fc_hash.h: manage hash tables for functions **/
   20 
   21 #ifndef __fc_hash_h_
   22 #define __fc_hash_h_
   23 
   24 #include <stdio.h>
   25 #include <stdlib.h>
   26 #include "fc_functions.h"
   27 
   28 /* max fill-ratio in the hash table */
   29 #define FC_HASH_MAX_RATIO   0.80
   30 
   31 /* structure of a hash table */
   32 typedef struct
   33 {
   34   int current_size;
   35   int current_nb;
   36   int current_mask;
   37   FC_Function *functions;
   38 } FC_FHash;
   39 
   40 /** functions **/
   41 /* create a hash table with initial size */
   42 /* size MUST be a power of 2 (not checked) */
   43 FC_FHash *fc_fhash_create(int size);
   44 
   45 /* destroy a hash table */
   46 void fc_fhash_delete(FC_FHash *hash);
   47 
   48 /* add an element in the hash table */
   49 FC_Function *fc_fhash_insert(FC_FHash *hash, FC_Function *fnc);
   50 
   51 /* find an element in the hash table */
   52 FC_Function *fc_fhash_find(FC_FHash *hash, void *fnc);
   53 
   54 #endif /* __fc_hash_h_ */