openbcm

Git mirror of https://github.com/Broadcom-Network-Switching-Software/OpenBCM
git clone git://git.finwo.net/mirror/broadcom/openbcm
Log | Files | Refs | README

phymod_symbols_index.c (775B)


      1 /*
      2  * 
      3  * This license is set out in https://raw.githubusercontent.com/Broadcom-Network-Switching-Software/OpenBCM/master/Legal/LICENSE file.
      4  * 
      5  * Copyright 2007-2019 Broadcom Inc. All rights reserved.
      6  */
      7 
      8 /*******************************************************************************
      9  *
     10  * PHYMOD Symbol Routines
     11  */
     12 
     13 #include <phymod/phymod_symbols.h>
     14 
     15 int
     16 phymod_symbols_index(const phymod_symbols_t *symbols, const phymod_symbol_t *symbol)
     17 {
     18     int size, i; 
     19 
     20     if (symbols == NULL || symbols->symbols == NULL) {
     21         return -1;
     22     }
     23 
     24     size = symbols->size;
     25     for (i = 0; i < size; i++) {
     26         /* Sufficient to compare just the pointers */
     27         if (symbol->name == symbols->symbols[i].name) {
     28             return i;
     29         }
     30     }
     31     return -1;
     32 }