mirror of
https://github.com/Hamlib/Hamlib.git
synced 2024-09-21 02:17:21 +00:00
Use pointers for amp->state references
This commit is contained in:
parent
fc8642fbf8
commit
105a411c74
@ -66,10 +66,10 @@ int kpa_init(AMP *amp)
|
|||||||
return -RIG_EINVAL;
|
return -RIG_EINVAL;
|
||||||
}
|
}
|
||||||
|
|
||||||
amp->state.priv = (struct kpa_priv_data *)
|
AMPSTATE(amp)->priv = (struct kpa_priv_data *)
|
||||||
calloc(1, sizeof(struct kpa_priv_data));
|
calloc(1, sizeof(struct kpa_priv_data));
|
||||||
|
|
||||||
if (!amp->state.priv)
|
if (!AMPSTATE(amp)->priv)
|
||||||
{
|
{
|
||||||
return -RIG_ENOMEM;
|
return -RIG_ENOMEM;
|
||||||
}
|
}
|
||||||
@ -83,9 +83,9 @@ int kpa_close(AMP *amp)
|
|||||||
{
|
{
|
||||||
rig_debug(RIG_DEBUG_VERBOSE, "%s called\n", __func__);
|
rig_debug(RIG_DEBUG_VERBOSE, "%s called\n", __func__);
|
||||||
|
|
||||||
if (amp->state.priv) { free(amp->state.priv); }
|
if (AMPSTATE(amp)->priv) { free(AMPSTATE(amp)->priv); }
|
||||||
|
|
||||||
amp->state.priv = NULL;
|
AMPSTATE(amp)->priv = NULL;
|
||||||
|
|
||||||
return RIG_OK;
|
return RIG_OK;
|
||||||
}
|
}
|
||||||
@ -271,7 +271,7 @@ int kpa_get_level(AMP *amp, setting_t level, value_t *val)
|
|||||||
int pwrinput;
|
int pwrinput;
|
||||||
float float_value = 0;
|
float float_value = 0;
|
||||||
int int_value = 0, int_value2 = 0;
|
int int_value = 0, int_value2 = 0;
|
||||||
struct kpa_priv_data *priv = amp->state.priv;
|
struct kpa_priv_data *priv = AMPSTATE(amp)->priv;
|
||||||
|
|
||||||
|
|
||||||
rig_debug(RIG_DEBUG_VERBOSE, "%s called\n", __func__);
|
rig_debug(RIG_DEBUG_VERBOSE, "%s called\n", __func__);
|
||||||
|
@ -68,10 +68,10 @@ int expert_init(AMP *amp)
|
|||||||
return -RIG_EINVAL;
|
return -RIG_EINVAL;
|
||||||
}
|
}
|
||||||
|
|
||||||
amp->state.priv = (struct expert_priv_data *)
|
AMPSTATE(amp)->priv = (struct expert_priv_data *)
|
||||||
calloc(1, sizeof(struct expert_priv_data));
|
calloc(1, sizeof(struct expert_priv_data));
|
||||||
|
|
||||||
if (!amp->state.priv)
|
if (!AMPSTATE(amp)->priv)
|
||||||
{
|
{
|
||||||
return -RIG_ENOMEM;
|
return -RIG_ENOMEM;
|
||||||
}
|
}
|
||||||
@ -102,9 +102,9 @@ int expert_close(AMP *amp)
|
|||||||
rig_debug(RIG_DEBUG_VERBOSE, "%s called\n", __func__);
|
rig_debug(RIG_DEBUG_VERBOSE, "%s called\n", __func__);
|
||||||
expert_transaction(amp, &cmd, 1, response, 4);
|
expert_transaction(amp, &cmd, 1, response, 4);
|
||||||
|
|
||||||
if (amp->state.priv) { free(amp->state.priv); }
|
if (AMPSTATE(amp)->priv) { free(AMPSTATE(amp)->priv); }
|
||||||
|
|
||||||
amp->state.priv = NULL;
|
AMPSTATE(amp)->priv = NULL;
|
||||||
|
|
||||||
return RIG_OK;
|
return RIG_OK;
|
||||||
}
|
}
|
||||||
@ -305,7 +305,7 @@ int expert_get_level(AMP *amp, setting_t level, value_t *val)
|
|||||||
int pwrinput;
|
int pwrinput;
|
||||||
float float_value = 0;
|
float float_value = 0;
|
||||||
int int_value = 0, int_value2 = 0;
|
int int_value = 0, int_value2 = 0;
|
||||||
struct expert_priv_data *priv = amp->state.priv;
|
struct expert_priv_data *priv = AMPSTATE(amp)->priv;
|
||||||
|
|
||||||
|
|
||||||
rig_debug(RIG_DEBUG_VERBOSE, "%s called\n", __func__);
|
rig_debug(RIG_DEBUG_VERBOSE, "%s called\n", __func__);
|
||||||
|
@ -45,10 +45,10 @@ int gemini_init(AMP *amp)
|
|||||||
return -RIG_EINVAL;
|
return -RIG_EINVAL;
|
||||||
}
|
}
|
||||||
|
|
||||||
amp->state.priv = (struct gemini_priv_data *)
|
AMPSTATE(amp)->priv = (struct gemini_priv_data *)
|
||||||
calloc(1, sizeof(struct gemini_priv_data));
|
calloc(1, sizeof(struct gemini_priv_data));
|
||||||
|
|
||||||
if (!amp->state.priv)
|
if (!AMPSTATE(amp)->priv)
|
||||||
{
|
{
|
||||||
return -RIG_ENOMEM;
|
return -RIG_ENOMEM;
|
||||||
}
|
}
|
||||||
@ -62,9 +62,9 @@ int gemini_close(AMP *amp)
|
|||||||
{
|
{
|
||||||
rig_debug(RIG_DEBUG_VERBOSE, "%s called\n", __func__);
|
rig_debug(RIG_DEBUG_VERBOSE, "%s called\n", __func__);
|
||||||
|
|
||||||
if (amp->state.priv) { free(amp->state.priv); }
|
if (AMPSTATE(amp)->priv) { free(AMPSTATE(amp)->priv); }
|
||||||
|
|
||||||
amp->state.priv = NULL;
|
AMPSTATE(amp)->priv = NULL;
|
||||||
|
|
||||||
return RIG_OK;
|
return RIG_OK;
|
||||||
}
|
}
|
||||||
@ -137,7 +137,7 @@ int gemini_status_parse(AMP *amp)
|
|||||||
int retval, n = 0;
|
int retval, n = 0;
|
||||||
char *p;
|
char *p;
|
||||||
char responsebuf[GEMINIBUFSZ];
|
char responsebuf[GEMINIBUFSZ];
|
||||||
struct gemini_priv_data *priv = amp->state.priv;
|
struct gemini_priv_data *priv = AMPSTATE(amp)->priv;
|
||||||
|
|
||||||
retval = gemini_transaction(amp, "S\n", responsebuf, sizeof(responsebuf));
|
retval = gemini_transaction(amp, "S\n", responsebuf, sizeof(responsebuf));
|
||||||
|
|
||||||
@ -189,7 +189,7 @@ int gemini_get_freq(AMP *amp, freq_t *freq)
|
|||||||
|
|
||||||
if (!amp) { return -RIG_EINVAL; }
|
if (!amp) { return -RIG_EINVAL; }
|
||||||
|
|
||||||
priv = amp->state.priv;
|
priv = AMPSTATE(amp)->priv;
|
||||||
|
|
||||||
retval = gemini_status_parse(amp);
|
retval = gemini_status_parse(amp);
|
||||||
|
|
||||||
@ -228,7 +228,7 @@ int gemini_set_freq(AMP *amp, freq_t freq)
|
|||||||
int gemini_get_level(AMP *amp, setting_t level, value_t *val)
|
int gemini_get_level(AMP *amp, setting_t level, value_t *val)
|
||||||
{
|
{
|
||||||
int retval;
|
int retval;
|
||||||
struct gemini_priv_data *priv = amp->state.priv;
|
struct gemini_priv_data *priv = AMPSTATE(amp)->priv;
|
||||||
|
|
||||||
|
|
||||||
rig_debug(RIG_DEBUG_VERBOSE, "%s called\n", __func__);
|
rig_debug(RIG_DEBUG_VERBOSE, "%s called\n", __func__);
|
||||||
|
Loading…
Reference in New Issue
Block a user