Be able to take string literal as ifname
`ifname` as the argument of `ec_init` and related functions is not changed, and therefore can be safely retyped to `const char *`. This allows using string literals. For example: ec_init(argc > 1 ? argv[1] : "eth0"); Signed-off-by: Shahbaz Youssefi <syoussefi@kinova.ca>
This commit is contained in:
parent
593a81a177
commit
469dd9623a
@ -321,7 +321,7 @@ static void ecx_mbxemergencyerror(ecx_contextt *context, uint16 Slave,uint16 Err
|
||||
* @param[in] ifname = Dev name, f.e. "eth0"
|
||||
* @return >0 if OK
|
||||
*/
|
||||
int ecx_init(ecx_contextt *context, char * ifname)
|
||||
int ecx_init(ecx_contextt *context, const char * ifname)
|
||||
{
|
||||
return ecx_setupnic(context->port, ifname, FALSE);
|
||||
}
|
||||
@ -333,7 +333,7 @@ int ecx_init(ecx_contextt *context, char * ifname)
|
||||
* @param[in] if2name = Secondary Dev name, f.e. "eth1"
|
||||
* @return >0 if OK
|
||||
*/
|
||||
int ecx_init_redundant(ecx_contextt *context, ecx_redportt *redport, char *ifname, char *if2name)
|
||||
int ecx_init_redundant(ecx_contextt *context, ecx_redportt *redport, const char *ifname, char *if2name)
|
||||
{
|
||||
int rval, zbuf;
|
||||
ec_etherheadert *ehp;
|
||||
@ -1905,7 +1905,7 @@ void ec_packeterror(uint16 Slave, uint16 Index, uint8 SubIdx, uint16 ErrorCode)
|
||||
* @return >0 if OK
|
||||
* @see ecx_init
|
||||
*/
|
||||
int ec_init(char * ifname)
|
||||
int ec_init(const char * ifname)
|
||||
{
|
||||
return ecx_init(&ecx_context, ifname);
|
||||
}
|
||||
@ -1916,7 +1916,7 @@ int ec_init(char * ifname)
|
||||
* @return >0 if OK
|
||||
* @see ecx_init_redundant
|
||||
*/
|
||||
int ec_init_redundant(char *ifname, char *if2name)
|
||||
int ec_init_redundant(const char *ifname, char *if2name)
|
||||
{
|
||||
return ecx_init_redundant (&ecx_context, &ecx_redport, ifname, if2name);
|
||||
}
|
||||
|
@ -473,8 +473,8 @@ void ec_pusherror(const ec_errort *Ec);
|
||||
boolean ec_poperror(ec_errort *Ec);
|
||||
boolean ec_iserror(void);
|
||||
void ec_packeterror(uint16 Slave, uint16 Index, uint8 SubIdx, uint16 ErrorCode);
|
||||
int ec_init(char * ifname);
|
||||
int ec_init_redundant(char *ifname, char *if2name);
|
||||
int ec_init(const char * ifname);
|
||||
int ec_init_redundant(const char *ifname, char *if2name);
|
||||
void ec_close(void);
|
||||
uint8 ec_siigetbyte(uint16 slave, uint16 address);
|
||||
int16 ec_siifind(uint16 slave, uint16 cat);
|
||||
@ -514,8 +514,8 @@ void ecx_pusherror(ecx_contextt *context, const ec_errort *Ec);
|
||||
boolean ecx_poperror(ecx_contextt *context, ec_errort *Ec);
|
||||
boolean ecx_iserror(ecx_contextt *context);
|
||||
void ecx_packeterror(ecx_contextt *context, uint16 Slave, uint16 Index, uint8 SubIdx, uint16 ErrorCode);
|
||||
int ecx_init(ecx_contextt *context, char * ifname);
|
||||
int ecx_init_redundant(ecx_contextt *context, ecx_redportt *redport, char *ifname, char *if2name);
|
||||
int ecx_init(ecx_contextt *context, const char * ifname);
|
||||
int ecx_init_redundant(ecx_contextt *context, ecx_redportt *redport, const char *ifname, char *if2name);
|
||||
void ecx_close(ecx_contextt *context);
|
||||
uint8 ecx_siigetbyte(ecx_contextt *context, uint16 slave, uint16 address);
|
||||
int16 ecx_siifind(ecx_contextt *context, uint16 slave, uint16 cat);
|
||||
|
Loading…
x
Reference in New Issue
Block a user