Skip to content

Commit

Permalink
Make dbFastGet/PutConvertRoutine arrays const
Browse files Browse the repository at this point in the history
Also added Doxygen annotations for them.
  • Loading branch information
anjohnson committed Jul 11, 2024
1 parent 079aafd commit b289d76
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 7 deletions.
25 changes: 20 additions & 5 deletions modules/database/src/ioc/db/dbConvertFast.h
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,20 @@
* EPICS Base is distributed subject to a Software License Agreement found
* in file LICENSE that is included with this distribution.
\*************************************************************************/
/* dbConvertFast.h */
/** @file dbConvertFast.h
* @brief Data conversion for scalar values
*
* The typedef FASTCONVERTFUNC is defined in link.h as:
* @code
* long convert(const void *from, void *to, const struct dbAddr *paddr);
* @endcode
*
* The arrays declared here provide pointers to the fast conversion
* routine where the first array index is the data type for the first
* "from" pointer arg, and the second array index is the data type for
* the second "to" pointer arg. The array index values are a subset of
* the DBF_ enum values defined in dbFldTypes.h
*/

#ifndef INCdbConvertFasth
#define INCdbConvertFasth
Expand All @@ -20,10 +33,12 @@
extern "C" {
#endif

/* typedef FASTCONVERTFUNC is now defined in link.h */

DBCORE_API extern FASTCONVERTFUNC dbFastGetConvertRoutine[DBF_DEVICE+1][DBR_ENUM+1];
DBCORE_API extern FASTCONVERTFUNC dbFastPutConvertRoutine[DBR_ENUM+1][DBF_DEVICE+1];
/** Function pointers for get conversions */
DBCORE_API extern const FASTCONVERTFUNC
dbFastGetConvertRoutine[DBF_DEVICE+1][DBR_ENUM+1];
/** Function pointers for put conversions */
DBCORE_API extern const FASTCONVERTFUNC
dbFastPutConvertRoutine[DBR_ENUM+1][DBF_DEVICE+1];

#ifdef __cplusplus
}
Expand Down
4 changes: 2 additions & 2 deletions modules/database/src/ioc/db/dbFastLinkConv.c
Original file line number Diff line number Diff line change
Expand Up @@ -1639,7 +1639,7 @@ static long cvt_device_st(const void *f, void *t, const dbAddr *paddr)
* NULL implies the conversion is not supported.
*/

FASTCONVERTFUNC dbFastGetConvertRoutine[DBF_DEVICE+1][DBR_ENUM+1] = {
FASTCONVERTFUNC const dbFastGetConvertRoutine[DBF_DEVICE+1][DBR_ENUM+1] = {

/* Convert DBF_STRING to ... */
{ cvt_st_st, cvt_st_c, cvt_st_uc, cvt_st_s, cvt_st_us, cvt_st_l, cvt_st_ul, cvt_st_q, cvt_st_uq, cvt_st_f, cvt_st_d, cvt_st_e },
Expand Down Expand Up @@ -1695,7 +1695,7 @@ FASTCONVERTFUNC dbFastGetConvertRoutine[DBF_DEVICE+1][DBR_ENUM+1] = {
* NULL implies the conversion is not supported.
*/

FASTCONVERTFUNC dbFastPutConvertRoutine[DBR_ENUM+1][DBF_DEVICE+1] = {
FASTCONVERTFUNC const dbFastPutConvertRoutine[DBR_ENUM+1][DBF_DEVICE+1] = {

/* Convert DBR_STRING to ... */
{ cvt_st_st, cvt_st_c, cvt_st_uc, cvt_st_s, cvt_st_us, cvt_st_l, cvt_st_ul, cvt_st_q, cvt_st_uq, cvt_st_f, cvt_st_d, cvt_st_e, cvt_st_menu, cvt_st_device},
Expand Down

0 comments on commit b289d76

Please sign in to comment.