kopia lustrzana https://github.com/Hamlib/Hamlib
Change malloc to calloc
rodzic
dd3208ad34
commit
627ec83652
|
@ -68,7 +68,7 @@ int kpa_init(AMP *amp)
|
|||
}
|
||||
|
||||
amp->state.priv = (struct kpa_priv_data *)
|
||||
malloc(sizeof(struct kpa_priv_data));
|
||||
calloc(1,sizeof(struct kpa_priv_data));
|
||||
|
||||
if (!amp->state.priv)
|
||||
{
|
||||
|
|
|
@ -44,7 +44,7 @@ int gemini_init(AMP *amp)
|
|||
}
|
||||
|
||||
amp->state.priv = (struct gemini_priv_data *)
|
||||
malloc(sizeof(struct gemini_priv_data));
|
||||
calloc(1,sizeof(struct gemini_priv_data));
|
||||
|
||||
if (!amp->state.priv)
|
||||
{
|
||||
|
|
|
@ -62,7 +62,7 @@ char *getlibpath(void)
|
|||
|
||||
if (!c) { continue; }
|
||||
|
||||
libpath = malloc(strlen(c) + 1);
|
||||
libpath = calloc(1,strlen(c) + 1);
|
||||
strcpy(libpath, c);
|
||||
break;
|
||||
}
|
||||
|
@ -115,7 +115,7 @@ lt_dlhandle adlopen(const char *filename)
|
|||
|
||||
if (libpath == NULL || filename == NULL) { return NULL; }
|
||||
|
||||
c = malloc(strlen(libpath) + strlen(APREFIX) + strlen(filename) + strlen(
|
||||
c = calloc(1,strlen(libpath) + strlen(APREFIX) + strlen(filename) + strlen(
|
||||
ASUFFIX) + 1);
|
||||
strcpy(c, libpath);
|
||||
strcat(c, APREFIX);
|
||||
|
|
|
@ -168,7 +168,7 @@ typedef struct internal_hooks
|
|||
/* work around MSVC error C2322: '...' address of dllimport '...' is not static */
|
||||
static void *CJSON_CDECL internal_malloc(size_t size)
|
||||
{
|
||||
return malloc(size);
|
||||
return calloc(1,size);
|
||||
}
|
||||
static void CJSON_CDECL internal_free(void *pointer)
|
||||
{
|
||||
|
|
|
@ -96,7 +96,7 @@ int getaddrinfo(const char *node, const char *service,
|
|||
return -1;
|
||||
}
|
||||
|
||||
p = malloc(sizeof(struct addrinfo));
|
||||
p = calloc(1,sizeof(struct addrinfo));
|
||||
|
||||
if (!p)
|
||||
{
|
||||
|
@ -108,7 +108,7 @@ int getaddrinfo(const char *node, const char *service,
|
|||
p->ai_socktype = ai_socktype;
|
||||
p->ai_protocol = ai_protocol;
|
||||
p->ai_addrlen = sizeof(struct sockaddr_in);
|
||||
p->ai_addr = malloc(p->ai_addrlen);
|
||||
p->ai_addr = calloc(1,p->ai_addrlen);
|
||||
|
||||
if (!p->ai_addr)
|
||||
{
|
||||
|
|
|
@ -223,7 +223,7 @@ exchange(argv)
|
|||
char **argv;
|
||||
{
|
||||
int nonopts_size = (last_nonopt - first_nonopt) * sizeof(char *);
|
||||
char **temp = (char **) malloc(nonopts_size);
|
||||
char **temp = (char **) calloc(1,nonopts_size);
|
||||
|
||||
/* Interchange the two blocks of data in ARGV. */
|
||||
|
||||
|
|
|
@ -1208,7 +1208,7 @@ static struct termios_list *add_port(const char *filename)
|
|||
|
||||
ENTER("add_port");
|
||||
|
||||
port = malloc(sizeof(struct termios_list));
|
||||
port = calloc(1,sizeof(struct termios_list));
|
||||
|
||||
if (!port)
|
||||
{
|
||||
|
@ -1217,7 +1217,7 @@ static struct termios_list *add_port(const char *filename)
|
|||
|
||||
memset(port, 0, sizeof(struct termios_list));
|
||||
|
||||
port->ttyset = malloc(sizeof(struct termios));
|
||||
port->ttyset = calloc(1,sizeof(struct termios));
|
||||
|
||||
if (! port->ttyset)
|
||||
{
|
||||
|
@ -1226,7 +1226,7 @@ static struct termios_list *add_port(const char *filename)
|
|||
|
||||
memset(port->ttyset, 0, sizeof(struct termios));
|
||||
|
||||
port->sstruct = malloc(sizeof(struct serial_struct));
|
||||
port->sstruct = calloc(1,sizeof(struct serial_struct));
|
||||
|
||||
if (! port->sstruct)
|
||||
{
|
||||
|
@ -1234,7 +1234,7 @@ static struct termios_list *add_port(const char *filename)
|
|||
}
|
||||
|
||||
memset(port->sstruct, 0, sizeof(struct serial_struct));
|
||||
port->sis = malloc(sizeof(struct serial_icounter_struct));
|
||||
port->sis = calloc(1,sizeof(struct serial_icounter_struct));
|
||||
|
||||
if (! port->sis)
|
||||
{
|
||||
|
@ -1244,7 +1244,7 @@ static struct termios_list *add_port(const char *filename)
|
|||
memset(port->sis, 0, sizeof(struct serial_icounter_struct));
|
||||
|
||||
/* FIXME the async_struct is being defined by mingw32 headers?
|
||||
port->astruct = malloc( sizeof( struct async_struct ) );
|
||||
port->astruct = calloc(1, sizeof( struct async_struct ) );
|
||||
if( ! port->astruct )
|
||||
goto fail;
|
||||
memset( port->astruct, 0, sizeof( struct async_struct ) );
|
||||
|
@ -3407,7 +3407,7 @@ int win32_serial_ioctl(int fd, int request, ...)
|
|||
case TIOCGSERIAL:
|
||||
report("TIOCGSERIAL\n");
|
||||
|
||||
dcb = malloc(sizeof(DCB));
|
||||
dcb = calloc(1,sizeof(DCB));
|
||||
|
||||
if (!dcb)
|
||||
{
|
||||
|
@ -3438,7 +3438,7 @@ int win32_serial_ioctl(int fd, int request, ...)
|
|||
case TIOCSSERIAL:
|
||||
report("TIOCSSERIAL\n");
|
||||
|
||||
dcb = malloc(sizeof(DCB));
|
||||
dcb = calloc(1,sizeof(DCB));
|
||||
|
||||
if (!dcb)
|
||||
{
|
||||
|
|
|
@ -282,7 +282,7 @@ int ar3030_init(RIG *rig)
|
|||
{
|
||||
struct ar3030_priv_data *priv;
|
||||
|
||||
rig->state.priv = malloc(sizeof(struct ar3030_priv_data));
|
||||
rig->state.priv = calloc(1,sizeof(struct ar3030_priv_data));
|
||||
|
||||
if (!rig->state.priv)
|
||||
{
|
||||
|
|
|
@ -257,7 +257,7 @@ static int ar7030p_init(RIG *rig)
|
|||
rig_debug(RIG_DEBUG_VERBOSE, "%s called\n", __func__);
|
||||
|
||||
priv = (struct ar7030p_priv_data *)
|
||||
malloc(sizeof(struct ar7030p_priv_data));
|
||||
calloc(1,sizeof(struct ar7030p_priv_data));
|
||||
|
||||
if (!priv)
|
||||
{
|
||||
|
|
|
@ -102,7 +102,7 @@ int drake_transaction(RIG *rig, const char *cmd, int cmd_len, char *data,
|
|||
int drake_init(RIG *rig)
|
||||
{
|
||||
struct drake_priv_data *priv;
|
||||
rig->state.priv = malloc(sizeof(struct drake_priv_data));
|
||||
rig->state.priv = calloc(1,sizeof(struct drake_priv_data));
|
||||
|
||||
if (!rig->state.priv)
|
||||
{
|
||||
|
|
|
@ -203,7 +203,7 @@ transaction_write:
|
|||
|
||||
len = strlen(cmdstr);
|
||||
|
||||
cmd = malloc(len + 2);
|
||||
cmd = calloc(1,len + 2);
|
||||
|
||||
if (cmd == NULL)
|
||||
{
|
||||
|
@ -515,7 +515,7 @@ int elad_init(RIG *rig)
|
|||
|
||||
rig_debug(RIG_DEBUG_VERBOSE, "%s called\n", __func__);
|
||||
|
||||
rig->state.priv = malloc(sizeof(struct elad_priv_data));
|
||||
rig->state.priv = calloc(1,sizeof(struct elad_priv_data));
|
||||
|
||||
if (rig->state.priv == NULL)
|
||||
{
|
||||
|
|
|
@ -195,7 +195,7 @@ int sdr1k_init(RIG *rig)
|
|||
{
|
||||
struct sdr1k_priv_data *priv;
|
||||
|
||||
rig->state.priv = (struct sdr1k_priv_data *)malloc(sizeof(
|
||||
rig->state.priv = (struct sdr1k_priv_data *)calloc(1,sizeof(
|
||||
struct sdr1k_priv_data));
|
||||
|
||||
if (!rig->state.priv)
|
||||
|
|
|
@ -114,7 +114,7 @@ static int gs100_init(RIG *rig)
|
|||
RETURNFUNC(-RIG_EINVAL);
|
||||
}
|
||||
|
||||
priv = (struct gs100_priv_data *)malloc(sizeof(struct gs100_priv_data));
|
||||
priv = (struct gs100_priv_data *)calloc(1,sizeof(struct gs100_priv_data));
|
||||
|
||||
if (!priv)
|
||||
{
|
||||
|
|
|
@ -132,7 +132,7 @@ int icmarine_init(RIG *rig)
|
|||
|
||||
priv_caps = (const struct icmarine_priv_caps *) caps->priv;
|
||||
|
||||
rig->state.priv = (struct icmarine_priv_data *)malloc(sizeof(
|
||||
rig->state.priv = (struct icmarine_priv_data *)calloc(1,sizeof(
|
||||
struct icmarine_priv_data));
|
||||
|
||||
if (!rig->state.priv)
|
||||
|
|
|
@ -70,7 +70,7 @@ int optoscan_open(RIG *rig)
|
|||
rs = &rig->state;
|
||||
priv = (struct icom_priv_data *)rs->priv;
|
||||
|
||||
pltstate = malloc(sizeof(pltstate_t));
|
||||
pltstate = calloc(1,sizeof(pltstate_t));
|
||||
|
||||
if (!pltstate)
|
||||
{
|
||||
|
|
|
@ -281,7 +281,7 @@ const struct rig_caps jst245_caps =
|
|||
static int jst145_init(RIG *rig)
|
||||
{
|
||||
struct jst145_priv_data *priv;
|
||||
priv = (struct jst145_priv_data *)malloc(sizeof(struct jst145_priv_data));
|
||||
priv = (struct jst145_priv_data *)calloc(1,sizeof(struct jst145_priv_data));
|
||||
|
||||
if (!priv)
|
||||
{
|
||||
|
|
|
@ -298,7 +298,7 @@ transaction_write:
|
|||
|
||||
len = strlen(cmdstr);
|
||||
|
||||
cmd = malloc(len + 2);
|
||||
cmd = calloc(1,len + 2);
|
||||
|
||||
if (cmd == NULL)
|
||||
{
|
||||
|
@ -724,7 +724,7 @@ int kenwood_init(RIG *rig)
|
|||
rig_debug(RIG_DEBUG_VERBOSE, "%s called, version %s/%s\n", __func__,
|
||||
BACKEND_VER, rig->caps->version);
|
||||
|
||||
rig->state.priv = malloc(sizeof(struct kenwood_priv_data));
|
||||
rig->state.priv = calloc(1,sizeof(struct kenwood_priv_data));
|
||||
|
||||
if (rig->state.priv == NULL)
|
||||
{
|
||||
|
|
|
@ -178,7 +178,7 @@ int xg3_init(RIG *rig)
|
|||
|
||||
rig_debug(RIG_DEBUG_VERBOSE, "%s called\n", __func__);
|
||||
|
||||
priv = (struct xg3_priv_data *)malloc(sizeof(struct xg3_priv_data));
|
||||
priv = (struct xg3_priv_data *)calloc(1,sizeof(struct xg3_priv_data));
|
||||
|
||||
if (!priv)
|
||||
{
|
||||
|
|
|
@ -171,7 +171,7 @@ int dds60_init(RIG *rig)
|
|||
{
|
||||
struct dds60_priv_data *priv;
|
||||
|
||||
rig->state.priv = (struct dds60_priv_data *)malloc(sizeof(
|
||||
rig->state.priv = (struct dds60_priv_data *)calloc(1,sizeof(
|
||||
struct dds60_priv_data));
|
||||
|
||||
if (!rig->state.priv)
|
||||
|
|
|
@ -171,7 +171,7 @@ int drt1_init(RIG *rig)
|
|||
{
|
||||
struct drt1_priv_data *priv;
|
||||
|
||||
rig->state.priv = (struct drt1_priv_data *)malloc(sizeof(
|
||||
rig->state.priv = (struct drt1_priv_data *)calloc(1,sizeof(
|
||||
struct drt1_priv_data));
|
||||
|
||||
if (!rig->state.priv)
|
||||
|
|
|
@ -228,7 +228,7 @@ int dwtdll_init(RIG *rig)
|
|||
{
|
||||
struct dwtdll_priv_data *priv;
|
||||
|
||||
rig->state.priv = (struct dwtdll_priv_data *)malloc(sizeof(
|
||||
rig->state.priv = (struct dwtdll_priv_data *)calloc(1,sizeof(
|
||||
struct dwtdll_priv_data));
|
||||
|
||||
if (!rig->state.priv)
|
||||
|
|
|
@ -163,7 +163,7 @@ int elektor304_init(RIG *rig)
|
|||
{
|
||||
struct elektor304_priv_data *priv;
|
||||
|
||||
rig->state.priv = (struct elektor304_priv_data *)malloc(sizeof(struct
|
||||
rig->state.priv = (struct elektor304_priv_data *)calloc(1,sizeof(struct
|
||||
elektor304_priv_data));
|
||||
|
||||
if (!rig->state.priv)
|
||||
|
|
|
@ -296,7 +296,7 @@ int hiqsdr_init(RIG *rig)
|
|||
|
||||
rig_debug(RIG_DEBUG_VERBOSE, "%s called\n", __func__);
|
||||
|
||||
rig->state.priv = (struct hiqsdr_priv_data *)malloc(sizeof(
|
||||
rig->state.priv = (struct hiqsdr_priv_data *)calloc(1,sizeof(
|
||||
struct hiqsdr_priv_data));
|
||||
|
||||
if (!rig->state.priv)
|
||||
|
|
|
@ -481,7 +481,7 @@ pcr_init(RIG *rig)
|
|||
return -RIG_EINVAL;
|
||||
}
|
||||
|
||||
rig->state.priv = (struct pcr_priv_data *) malloc(sizeof(struct pcr_priv_data));
|
||||
rig->state.priv = (struct pcr_priv_data *) calloc(1,sizeof(struct pcr_priv_data));
|
||||
|
||||
if (!rig->state.priv)
|
||||
{
|
||||
|
|
|
@ -219,7 +219,7 @@ int ra37xx_init(RIG *rig)
|
|||
return -RIG_EINVAL;
|
||||
}
|
||||
|
||||
rig->state.priv = (struct ra37xx_priv_data *)malloc(sizeof(
|
||||
rig->state.priv = (struct ra37xx_priv_data *)calloc(1,sizeof(
|
||||
struct ra37xx_priv_data));
|
||||
|
||||
if (!rig->state.priv)
|
||||
|
|
|
@ -124,7 +124,7 @@ int racal_init(RIG *rig)
|
|||
return -RIG_EINVAL;
|
||||
}
|
||||
|
||||
rig->state.priv = (struct racal_priv_data *)malloc(sizeof(
|
||||
rig->state.priv = (struct racal_priv_data *)calloc(1,sizeof(
|
||||
struct racal_priv_data));
|
||||
|
||||
if (!rig->state.priv)
|
||||
|
|
|
@ -217,7 +217,7 @@ static int cu_open(RIG *rig)
|
|||
|
||||
rig_debug(RIG_DEBUG_TRACE, "%s called\n", __func__);
|
||||
|
||||
rig->state.priv = malloc(sizeof(struct cu_priv_data));
|
||||
rig->state.priv = calloc(1,sizeof(struct cu_priv_data));
|
||||
|
||||
if (!rig->state.priv)
|
||||
{
|
||||
|
|
|
@ -293,7 +293,7 @@ int tt538_init(RIG *rig)
|
|||
{
|
||||
struct tt538_priv_data *priv;
|
||||
|
||||
rig->state.priv = (struct tt538_priv_data *) malloc(sizeof(
|
||||
rig->state.priv = (struct tt538_priv_data *) calloc(1,sizeof(
|
||||
struct tt538_priv_data));
|
||||
|
||||
if (!rig->state.priv)
|
||||
|
|
|
@ -332,7 +332,7 @@ int tt588_init(RIG *rig)
|
|||
struct tt588_priv_data *priv;
|
||||
|
||||
rig_debug(RIG_DEBUG_VERBOSE, "%s:\n", __func__);
|
||||
rig->state.priv = (struct tt588_priv_data *) malloc(sizeof(
|
||||
rig->state.priv = (struct tt588_priv_data *) calloc(1,sizeof(
|
||||
struct tt588_priv_data));
|
||||
|
||||
if (!rig->state.priv)
|
||||
|
|
|
@ -225,7 +225,7 @@ static int tt565_transaction(RIG *rig, const char *cmd, int cmd_len, char *data,
|
|||
int tt565_init(RIG *rig)
|
||||
{
|
||||
struct tt565_priv_data *priv;
|
||||
rig->state.priv = (struct tt565_priv_data *)malloc(sizeof(
|
||||
rig->state.priv = (struct tt565_priv_data *)calloc(1,sizeof(
|
||||
struct tt565_priv_data));
|
||||
|
||||
if (!rig->state.priv) { return -RIG_ENOMEM; } /* no memory available */
|
||||
|
|
|
@ -212,7 +212,7 @@ int tt585_init(RIG *rig)
|
|||
{
|
||||
struct tt585_priv_data *priv;
|
||||
|
||||
rig->state.priv = (struct tt585_priv_data *) malloc(sizeof(
|
||||
rig->state.priv = (struct tt585_priv_data *) calloc(1,sizeof(
|
||||
struct tt585_priv_data));
|
||||
|
||||
if (!rig->state.priv)
|
||||
|
|
|
@ -295,7 +295,7 @@ int rx331_init(RIG *rig)
|
|||
{
|
||||
struct rx331_priv_data *priv;
|
||||
|
||||
rig->state.priv = (struct rx331_priv_data *)malloc(sizeof(
|
||||
rig->state.priv = (struct rx331_priv_data *)calloc(1,sizeof(
|
||||
struct rx331_priv_data));
|
||||
|
||||
if (!rig->state.priv)
|
||||
|
|
|
@ -239,7 +239,7 @@ int rx340_init(RIG *rig)
|
|||
{
|
||||
struct rx340_priv_data *priv;
|
||||
|
||||
priv = (struct rx340_priv_data *)malloc(sizeof(struct rx340_priv_data));
|
||||
priv = (struct rx340_priv_data *)calloc(1,sizeof(struct rx340_priv_data));
|
||||
|
||||
if (!priv)
|
||||
{
|
||||
|
|
|
@ -109,7 +109,7 @@ int tentec_init(RIG *rig)
|
|||
{
|
||||
struct tentec_priv_data *priv;
|
||||
|
||||
rig->state.priv = (struct tentec_priv_data *)malloc(sizeof(
|
||||
rig->state.priv = (struct tentec_priv_data *)calloc(1,sizeof(
|
||||
struct tentec_priv_data));
|
||||
|
||||
if (!rig->state.priv)
|
||||
|
|
|
@ -360,7 +360,7 @@ tt550_init(RIG *rig)
|
|||
{
|
||||
struct tt550_priv_data *priv;
|
||||
|
||||
rig->state.priv = (struct tt550_priv_data *) malloc(sizeof(
|
||||
rig->state.priv = (struct tt550_priv_data *) calloc(1,sizeof(
|
||||
struct tt550_priv_data));
|
||||
|
||||
if (!rig->state.priv)
|
||||
|
|
|
@ -190,7 +190,7 @@ int g3_init(RIG *rig)
|
|||
{
|
||||
struct g3_priv_data *priv;
|
||||
|
||||
rig->state.priv = (struct g3_priv_data *)malloc(sizeof(struct g3_priv_data));
|
||||
rig->state.priv = (struct g3_priv_data *)calloc(1,sizeof(struct g3_priv_data));
|
||||
|
||||
if (!rig->state.priv)
|
||||
{
|
||||
|
|
|
@ -191,7 +191,7 @@ int g3_init(RIG *rig)
|
|||
{
|
||||
struct g3_priv_data *priv;
|
||||
|
||||
rig->state.priv = (struct g3_priv_data *)malloc(sizeof(struct g3_priv_data));
|
||||
rig->state.priv = (struct g3_priv_data *)calloc(1,sizeof(struct g3_priv_data));
|
||||
|
||||
if (!rig->state.priv)
|
||||
{
|
||||
|
|
|
@ -112,7 +112,7 @@ int g313_init(RIG *rig)
|
|||
{
|
||||
struct g313_priv_data *priv;
|
||||
|
||||
priv = (struct g313_priv_data *)malloc(sizeof(struct g313_priv_data));
|
||||
priv = (struct g313_priv_data *)calloc(1,sizeof(struct g313_priv_data));
|
||||
|
||||
if (!priv)
|
||||
{
|
||||
|
|
|
@ -234,7 +234,7 @@ int g313_init(RIG *rig)
|
|||
{
|
||||
struct g313_priv_data *priv;
|
||||
|
||||
rig->state.priv = (struct g313_priv_data *)malloc(sizeof(
|
||||
rig->state.priv = (struct g313_priv_data *)calloc(1,sizeof(
|
||||
struct g313_priv_data));
|
||||
|
||||
if (!rig->state.priv)
|
||||
|
|
|
@ -211,7 +211,7 @@ int wj_init(RIG *rig)
|
|||
return -RIG_EINVAL;
|
||||
}
|
||||
|
||||
rig->state.priv = (struct wj_priv_data *)malloc(sizeof(struct wj_priv_data));
|
||||
rig->state.priv = (struct wj_priv_data *)calloc(1,sizeof(struct wj_priv_data));
|
||||
|
||||
if (!rig->state.priv)
|
||||
{
|
||||
|
|
|
@ -147,7 +147,7 @@ ars_init(ROT *rot)
|
|||
return -RIG_EINVAL;
|
||||
}
|
||||
|
||||
rot->state.priv = (struct ars_priv_data *)malloc(sizeof(struct ars_priv_data));
|
||||
rot->state.priv = (struct ars_priv_data *)calloc(1,sizeof(struct ars_priv_data));
|
||||
|
||||
if (!rot->state.priv)
|
||||
{
|
||||
|
|
|
@ -118,7 +118,7 @@ static int hd1780_rot_init(ROT *rot)
|
|||
}
|
||||
|
||||
rot->state.priv = (struct hd1780_rot_priv_data *)
|
||||
malloc(sizeof(struct hd1780_rot_priv_data));
|
||||
calloc(1,sizeof(struct hd1780_rot_priv_data));
|
||||
|
||||
if (!rot->state.priv)
|
||||
{
|
||||
|
|
|
@ -364,7 +364,7 @@ static int rotorez_rot_init(ROT *rot)
|
|||
}
|
||||
|
||||
rot->state.priv = (struct rotorez_rot_priv_data *)
|
||||
malloc(sizeof(struct rotorez_rot_priv_data));
|
||||
calloc(1,sizeof(struct rotorez_rot_priv_data));
|
||||
|
||||
if (!rot->state.priv)
|
||||
{
|
||||
|
|
|
@ -55,7 +55,7 @@ static int spid_rot_init(ROT *rot)
|
|||
{
|
||||
struct spid_rot2prog_priv_data *priv;
|
||||
|
||||
priv = (struct spid_rot2prog_priv_data *)malloc(sizeof(struct
|
||||
priv = (struct spid_rot2prog_priv_data *)calloc(1,sizeof(struct
|
||||
spid_rot2prog_priv_data));
|
||||
|
||||
if (!priv)
|
||||
|
|
|
@ -51,7 +51,7 @@ static int ts7400_rot_init(ROT *rot)
|
|||
rig_debug(RIG_DEBUG_VERBOSE, "%s called\n", __func__);
|
||||
|
||||
rot->state.priv = (struct ts7400_rot_priv_data *)
|
||||
malloc(sizeof(struct ts7400_rot_priv_data));
|
||||
calloc(1,sizeof(struct ts7400_rot_priv_data));
|
||||
|
||||
if (!rot->state.priv)
|
||||
{
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
|
||||
char *make_digest(const unsigned char *digest, int len) /* {{{ */
|
||||
{
|
||||
char *md5str = (char *) malloc(sizeof(char) * (len * 2 + 1));
|
||||
char *md5str = (char *) calloc(1,sizeof(char) * (len * 2 + 1));
|
||||
static const char hexits[17] = "0123456789abcdef";
|
||||
int i;
|
||||
|
||||
|
|
|
@ -152,7 +152,7 @@ int HAMLIB_API amp_register(const struct amp_caps *caps)
|
|||
|
||||
#endif
|
||||
|
||||
p = (struct amp_list *)malloc(sizeof(struct amp_list));
|
||||
p = (struct amp_list *)calloc(1,sizeof(struct amp_list));
|
||||
|
||||
if (!p)
|
||||
{
|
||||
|
|
|
@ -87,7 +87,7 @@ static struct opened_amp_l *opened_amp_list = { NULL };
|
|||
static int add_opened_amp(AMP *amp)
|
||||
{
|
||||
struct opened_amp_l *p;
|
||||
p = (struct opened_amp_l *)malloc(sizeof(struct opened_amp_l));
|
||||
p = (struct opened_amp_l *)calloc(1,sizeof(struct opened_amp_l));
|
||||
|
||||
if (!p)
|
||||
{
|
||||
|
|
|
@ -253,7 +253,7 @@ static int generic_retr_extl(RIG *rig,
|
|||
|
||||
if (chan->ext_levels == NULL)
|
||||
{
|
||||
p = chan->ext_levels = malloc(2 * sizeof(struct ext_list));
|
||||
p = chan->ext_levels = calloc(1,2 * sizeof(struct ext_list));
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -816,7 +816,7 @@ int HAMLIB_API rig_set_channel(RIG *rig, vfo_t vfo, const channel_t *chan)
|
|||
* and memory number selected. Depending on backend and rig capabilities,
|
||||
* the chan struct may not be filled in completely.
|
||||
*
|
||||
* Note: chan->ext_levels is a pointer to a newly mallocated memory.
|
||||
* Note: chan->ext_levels is a pointer to a newly allocated memory.
|
||||
* This is the responsibility of the caller to manage and eventually
|
||||
* free it.
|
||||
*
|
||||
|
|
|
@ -205,7 +205,7 @@ int HAMLIB_API rig_register(const struct rig_caps *caps)
|
|||
caps->rig_model);
|
||||
#endif
|
||||
|
||||
p = (struct rig_list *)malloc(sizeof(struct rig_list));
|
||||
p = (struct rig_list *)calloc(1,sizeof(struct rig_list));
|
||||
|
||||
if (!p)
|
||||
{
|
||||
|
|
|
@ -240,7 +240,7 @@ static int add_opened_rig(RIG *rig)
|
|||
{
|
||||
struct opened_rig_l *p;
|
||||
|
||||
p = (struct opened_rig_l *)malloc(sizeof(struct opened_rig_l));
|
||||
p = (struct opened_rig_l *)calloc(1,sizeof(struct opened_rig_l));
|
||||
|
||||
if (!p)
|
||||
{
|
||||
|
@ -850,7 +850,7 @@ int HAMLIB_API rig_open(RIG *rig)
|
|||
|
||||
rig_settings_load_all(NULL); // load default .hamlib_settings
|
||||
// Read in our settings
|
||||
char *cwd = malloc(4096);
|
||||
char *cwd = calloc(1,4096);
|
||||
|
||||
if (getcwd(cwd, 4096) == NULL)
|
||||
{
|
||||
|
@ -859,7 +859,7 @@ int HAMLIB_API rig_open(RIG *rig)
|
|||
else
|
||||
{
|
||||
rig_debug(RIG_DEBUG_VERBOSE, "%s: cwd=%s\n", __func__, cwd);
|
||||
char *path = malloc(4096);
|
||||
char *path = calloc(1,4096);
|
||||
extern char *settings_file;
|
||||
char *xdgpath = getenv("XDG_CONFIG_HOME");
|
||||
|
||||
|
|
|
@ -204,7 +204,7 @@ int HAMLIB_API rot_register(const struct rot_caps *caps)
|
|||
|
||||
#endif
|
||||
|
||||
p = (struct rot_list *)malloc(sizeof(struct rot_list));
|
||||
p = (struct rot_list *)calloc(1,sizeof(struct rot_list));
|
||||
|
||||
if (!p)
|
||||
{
|
||||
|
|
|
@ -108,7 +108,7 @@ static struct opened_rot_l *opened_rot_list = { NULL };
|
|||
static int add_opened_rot(ROT *rot)
|
||||
{
|
||||
struct opened_rot_l *p;
|
||||
p = (struct opened_rot_l *)malloc(sizeof(struct opened_rot_l));
|
||||
p = (struct opened_rot_l *)calloc(1,sizeof(struct opened_rot_l));
|
||||
|
||||
if (!p)
|
||||
{
|
||||
|
|
|
@ -618,7 +618,7 @@ int HAMLIB_API serial_setup(hamlib_port_t *rp)
|
|||
#endif
|
||||
|
||||
// Store a copy of the original options for this FD, to be restored on close.
|
||||
term_backup = malloc(sizeof(term_options_backup_t));
|
||||
term_backup = calloc(1,sizeof(term_options_backup_t));
|
||||
term_backup-> fd = fd;
|
||||
#if defined(HAVE_TERMIOS_H) || defined(HAVE_TERMIO_H)
|
||||
memcpy(&term_backup->options, &orig_options, sizeof(orig_options));
|
||||
|
|
|
@ -232,7 +232,7 @@ void hash_add_model(int id,
|
|||
{
|
||||
struct mod_lst *s;
|
||||
|
||||
s = (struct mod_lst *)malloc(sizeof(struct mod_lst));
|
||||
s = (struct mod_lst *)calloc(1,sizeof(struct mod_lst));
|
||||
|
||||
s->id = id;
|
||||
SNPRINTF(s->mfg_name, sizeof(s->mfg_name), "%s", mfg_name);
|
||||
|
|
|
@ -540,11 +540,11 @@ int main(int argc, char *argv[])
|
|||
*/
|
||||
do
|
||||
{
|
||||
arg = malloc(sizeof(struct handle_data));
|
||||
arg = calloc(1,sizeof(struct handle_data));
|
||||
|
||||
if (!arg)
|
||||
{
|
||||
rig_debug(RIG_DEBUG_ERR, "malloc: %s\n", strerror(errno));
|
||||
rig_debug(RIG_DEBUG_ERR, "calloc: %s\n", strerror(errno));
|
||||
exit(1);
|
||||
}
|
||||
|
||||
|
|
|
@ -426,7 +426,7 @@ void hash_add_model(int id,
|
|||
{
|
||||
struct mod_lst *s;
|
||||
|
||||
s = (struct mod_lst *)malloc(sizeof(struct mod_lst));
|
||||
s = (struct mod_lst *)calloc(1,sizeof(struct mod_lst));
|
||||
|
||||
s->id = id;
|
||||
SNPRINTF(s->mfg_name, sizeof(s->mfg_name), "%s", mfg_name);
|
||||
|
|
|
@ -291,7 +291,7 @@ void hash_add_model(int id,
|
|||
{
|
||||
struct mod_lst *s;
|
||||
|
||||
s = (struct mod_lst *)malloc(sizeof(struct mod_lst));
|
||||
s = (struct mod_lst *)calloc(1,sizeof(struct mod_lst));
|
||||
|
||||
s->id = id;
|
||||
SNPRINTF(s->mfg_name, sizeof(s->mfg_name), "%s", mfg_name);
|
||||
|
|
|
@ -570,11 +570,11 @@ int main(int argc, char *argv[])
|
|||
*/
|
||||
do
|
||||
{
|
||||
arg = malloc(sizeof(struct handle_data));
|
||||
arg = calloc(1,sizeof(struct handle_data));
|
||||
|
||||
if (!arg)
|
||||
{
|
||||
rig_debug(RIG_DEBUG_ERR, "malloc: %s\n", strerror(errno));
|
||||
rig_debug(RIG_DEBUG_ERR, "calloc: %s\n", strerror(errno));
|
||||
exit(1);
|
||||
}
|
||||
|
||||
|
|
Ładowanie…
Reference in New Issue