1
0
mirror of https://git.zap.org.au/git/trader.git synced 2024-10-27 18:20:13 -04:00

Remove the superfluous argument to chstrdup()

This argument is not required: we KNOW that we have initialised chtype
arrays with an ending NUL!
This commit is contained in:
John Zaitseff 2011-08-18 14:53:03 +10:00
parent bee30b7343
commit 4d6f1478e6
4 changed files with 8 additions and 9 deletions

View File

@ -412,7 +412,7 @@ void visit_bank (void)
mkchstr(chbuf, BUFSIZE, attr_normal, attr_normal | A_BOLD, 0, 1, mkchstr(chbuf, BUFSIZE, attr_normal, attr_normal | A_BOLD, 0, 1,
getmaxx(curwin) / 2, &width_cursym, 1, "^{%s^}", getmaxx(curwin) / 2, &width_cursym, 1, "^{%s^}",
lconvinfo.currency_symbol); lconvinfo.currency_symbol);
chbuf_cursym = chstrdup(chbuf, BUFSIZE); chbuf_cursym = chstrdup(chbuf);
mkchstr(chbuf, BUFSIZE, attr_normal, 0, 0, 1, getmaxx(curwin) mkchstr(chbuf, BUFSIZE, attr_normal, 0, 0, 1, getmaxx(curwin)
- BANK_INPUT_COLS - width_cursym - 6, &width, 1, - BANK_INPUT_COLS - width_cursym - 6, &width, 1,
@ -470,7 +470,7 @@ void visit_bank (void)
mkchstr(chbuf, BUFSIZE, attr_normal, attr_normal | A_BOLD, 0, 1, mkchstr(chbuf, BUFSIZE, attr_normal, attr_normal | A_BOLD, 0, 1,
getmaxx(curwin) / 2, &width_cursym, 1, "^{%s^}", getmaxx(curwin) / 2, &width_cursym, 1, "^{%s^}",
lconvinfo.currency_symbol); lconvinfo.currency_symbol);
chbuf_cursym = chstrdup(chbuf, BUFSIZE); chbuf_cursym = chstrdup(chbuf);
mkchstr(chbuf, BUFSIZE, attr_normal, 0, 0, 1, getmaxx(curwin) mkchstr(chbuf, BUFSIZE, attr_normal, 0, 0, 1, getmaxx(curwin)
- BANK_INPUT_COLS - width_cursym - 6, &width, 1, - BANK_INPUT_COLS - width_cursym - 6, &width, 1,

View File

@ -1241,7 +1241,7 @@ error:
/***********************************************************************/ /***********************************************************************/
// chstrdup: Duplicate a chtype buffer // chstrdup: Duplicate a chtype buffer
chtype *chstrdup (const chtype *restrict chstr, int chstrsize) chtype *chstrdup (const chtype *restrict chstr)
{ {
const chtype *p; const chtype *p;
int len; int len;
@ -1249,7 +1249,7 @@ chtype *chstrdup (const chtype *restrict chstr, int chstrsize)
// Determine chstr length, including ending NUL // Determine chstr length, including ending NUL
for (len = 1, p = chstr; *p != '\0' && len <= chstrsize; p++, len++) for (len = 1, p = chstr; *p != '\0'; p++, len++)
; ;
ret = xmalloc(len * sizeof(chtype)); ret = xmalloc(len * sizeof(chtype));

View File

@ -412,7 +412,6 @@ extern int vmkchstr (chtype *restrict chbuf, int chbufsize, chtype attr_norm,
/* /*
Function: chstrdup - Duplicate a chtype string Function: chstrdup - Duplicate a chtype string
Parameters: chstr - String to duplicate Parameters: chstr - String to duplicate
chstrsize - Maximum number of chtype elements in chstr
Returns: chtype * - Pointer to new (duplicated) string Returns: chtype * - Pointer to new (duplicated) string
This function returns a new string of type chtype * that contains a This function returns a new string of type chtype * that contains a
@ -420,7 +419,7 @@ extern int vmkchstr (chtype *restrict chbuf, int chbufsize, chtype attr_norm,
memory is not available, the program terminates with an "Out of memory" memory is not available, the program terminates with an "Out of memory"
message. message.
*/ */
extern chtype *chstrdup (const chtype *restrict chstr, int chstrsize); extern chtype *chstrdup (const chtype *restrict chstr);
/* /*

View File

@ -788,11 +788,11 @@ void merge_companies (map_val_t a, map_val_t b)
mkchstr(chbuf, BUFSIZE, attr_highlight, 0, 0, 1, getmaxx(curwin) / 2, mkchstr(chbuf, BUFSIZE, attr_highlight, 0, 0, 1, getmaxx(curwin) / 2,
&width_aa, 1, "%s", company[aa].name); &width_aa, 1, "%s", company[aa].name);
chbuf_aa = chstrdup(chbuf, BUFSIZE); chbuf_aa = chstrdup(chbuf);
mkchstr(chbuf, BUFSIZE, attr_highlight, 0, 0, 1, getmaxx(curwin) / 2, mkchstr(chbuf, BUFSIZE, attr_highlight, 0, 0, 1, getmaxx(curwin) / 2,
&width_bb, 1, "%s", company[bb].name); &width_bb, 1, "%s", company[bb].name);
chbuf_bb = chstrdup(chbuf, BUFSIZE); chbuf_bb = chstrdup(chbuf);
mkchstr(chbuf, BUFSIZE, attr_normal, 0, 0, 1, getmaxx(curwin) / 2, mkchstr(chbuf, BUFSIZE, attr_normal, 0, 0, 1, getmaxx(curwin) / 2,
&width, 1, &width, 1,
@ -1032,7 +1032,7 @@ void adjust_values (void)
mkchstr(chbuf, BUFSIZE, attr_error_highlight, 0, 0, 1, w / 2, mkchstr(chbuf, BUFSIZE, attr_error_highlight, 0, 0, 1, w / 2,
&width_amt, 1, "%N", company[which].share_price); &width_amt, 1, "%N", company[which].share_price);
chbuf_amt = chstrdup(chbuf, BUFSIZE); chbuf_amt = chstrdup(chbuf);
mkchstr(chbuf, BUFSIZE, attr_error_normal, 0, 0, 1, w / 2, mkchstr(chbuf, BUFSIZE, attr_error_normal, 0, 0, 1, w / 2,
&width, 1, &width, 1,