char client_buf[32];
csv_record_t *rec1;
- sprintf(msglen_buf, "%4d", msglen);
- sprintf(vers_buf, "%4d", version);
- sprintf(type_buf, "%4d", type);
- sprintf(cmdid_buf, "%4d", cmd_id);
+ snprintf(msglen_buf, sizeof(msglen_buf), "%4d", msglen);
+ snprintf(vers_buf, sizeof(vers_buf), "%4d", version);
+ snprintf(type_buf, sizeof(type_buf), "%4d", type);
+ snprintf(cmdid_buf, sizeof(cmdid_buf), "%4d", cmd_id);
snprintf(client_buf, 17, "%16.16s", client_name);
if (rec) {
rec1 = csv_encode_record(csv, rec, 5, msglen_buf, vers_buf,
csv_record_t *mh_rec, *rec;
if (!p_ctxt) {
- ERRLOG("%s: no context \n", __FUNCTION__);
+ ERRLOG("%s: no context \n", __func__);
return -1;
}
/* append to the hdr record */
rec = csv_append_record(csv, rec, 1, key);
if (!rec) {
- ERRLOG("%s: Could not append key \n", __FUNCTION__);
+ ERRLOG("%s: Could not append key \n", __func__);
return -1;
}
/* append to the data record */
rec = csv_append_record(csv, rec, 1, val);
if (!rec) {
- ERRLOG("%s: Could not append val \n", __FUNCTION__);
+ ERRLOG("%s: Could not append val \n", __func__);
return -1;
}
csv = csv_init(NULL, NULL, PTMLIB_MSG_SZ);
if (!csv) {
- ERRLOG("%s: Could not allocate csv \n", __FUNCTION__);
+ ERRLOG("%s: Could not allocate csv \n", __func__);
return -1;
}
cmd_id, hdl->client_name);
if (!rec) {
- ERRLOG("%s: Could not allocate record \n", __FUNCTION__);
+ ERRLOG("%s: Could not allocate record \n", __func__);
csv_clean(csv);
csv_free(csv);
return -1;
p_ctxt = calloc(1, sizeof(*p_ctxt));
if (!p_ctxt) {
- ERRLOG("%s: Could not allocate context \n", __FUNCTION__);
+ ERRLOG("%s: Could not allocate context \n", __func__);
csv_clean(csv);
csv_free(csv);
return -1;
csv_t *csv;
if (!p_ctxt) {
- ERRLOG("%s: no context \n", __FUNCTION__);
+ ERRLOG("%s: no context \n", __func__);
return -1;
}
csv_record_t *rec;
if (!p_ctxt) {
- ERRLOG("%s: no context \n", __FUNCTION__);
+ ERRLOG("%s: no context \n", __func__);
return -1;
}
/* parse csv contents into string */
if (buf && len) {
if (csv_serialize(csv, buf, *len)) {
- ERRLOG("%s: cannot serialize\n", __FUNCTION__);
+ ERRLOG("%s: cannot serialize\n", __func__);
return -1;
}
*len = csvlen(csv);
csv_decode(csv, inbuf);
p_ctxt = calloc(1, sizeof(*p_ctxt));
if (!p_ctxt) {
- ERRLOG("%s: Could not allocate context \n",
- __FUNCTION__);
+ ERRLOG("%s: Could not allocate context \n", __func__);
csv_clean(csv);
csv_free(csv);
return -1;