# HG changeset patch # User Florian Pose # Date 1212744139 0 # Node ID 01702c78fe0aec1649712bf105724d67257df15c # Parent ea83a7aab57a8060a0b4d012908fbb381e84b10e Added ec_sdo_get_entry_const(). diff -r ea83a7aab57a -r 01702c78fe0a master/sdo.c --- a/master/sdo.c Fri Jun 06 09:15:56 2008 +0000 +++ b/master/sdo.c Fri Jun 06 09:22:19 2008 +0000 @@ -154,7 +154,7 @@ /*****************************************************************************/ -/** Get and Sdo entry from an Sdo via its subindex. +/** Get an Sdo entry from an Sdo via its subindex. * * \retval >0 Pointer to the requested Sdo entry. * \retval NULL Sdo entry not found. @@ -167,7 +167,33 @@ ec_sdo_entry_t *entry; list_for_each_entry(entry, &sdo->entries, list) { - if (entry->subindex != subindex) continue; + if (entry->subindex != subindex) + continue; + return entry; + } + + return NULL; +} + +/*****************************************************************************/ + +/** Get an Sdo entry from an Sdo via its subindex. + * + * const version. + * + * \retval >0 Pointer to the requested Sdo entry. + * \retval NULL Sdo entry not found. + */ +const ec_sdo_entry_t *ec_sdo_get_entry_const( + const ec_sdo_t *sdo, /**< Sdo. */ + uint8_t subindex /**< Entry subindex. */ + ) +{ + const ec_sdo_entry_t *entry; + + list_for_each_entry(entry, &sdo->entries, list) { + if (entry->subindex != subindex) + continue; return entry; } diff -r ea83a7aab57a -r 01702c78fe0a master/sdo.h --- a/master/sdo.h Fri Jun 06 09:15:56 2008 +0000 +++ b/master/sdo.h Fri Jun 06 09:22:19 2008 +0000 @@ -68,6 +68,7 @@ void ec_sdo_destroy(ec_sdo_t *); ec_sdo_entry_t *ec_sdo_get_entry(ec_sdo_t *, uint8_t); +const ec_sdo_entry_t *ec_sdo_get_entry_const(const ec_sdo_t *, uint8_t); /*****************************************************************************/