void writedc(const char *str, PASS pass)
{
- WORD adr = 0x0;
+ WORD adr = 0;
if(*str == '\'') {
writestr(str, false, pass);
void assemble_in(const CMDLINE *cmdl, PASS pass)
{
- char *line = NULL;
+ char *line = malloc_chk(LINESIZE + 1, "assemble_in.line");
- line = malloc_chk(LINESIZE + 1, "assemble_in.line");
if(cmdl->opd->opdc == 0 || cmdl->opd->opdc > 2) {
setcerr(106, ""); /* operand count mismatch */
return;
void assemble_out(const CMDLINE *cmdl, PASS pass)
{
- char *line = NULL;
+ char *line = malloc_chk(LINESIZE + 1, "assemble_out.line");
- line = malloc_chk(LINESIZE + 1, "assemble_out.line");
if(cmdl->opd->opdc == 0 || cmdl->opd->opdc > 2) {
setcerr(106, ""); /* operand count mismatch */
return;
void assemble_rpush(const CMDLINE *cmdl, PASS pass)
{
- char *line = NULL;
+ char *line = malloc_chk(LINESIZE + 1, "assemble_rpush.line");
- line = malloc_chk(LINESIZE + 1, "assemble_rpush.line");
if(cmdl->opd->opdc > 0) {
setcerr(106, ""); /* operand count mismatch */
return;
void assemble_rpop(const CMDLINE *cmdl, PASS pass)
{
- char *line = NULL;
+ char *line = malloc_chk(LINESIZE + 1, "assemble_rpop.line");
- line = malloc_chk(LINESIZE + 1, "assemble_rpop.line");
if(cmdl->opd->opdc > 0) {
setcerr(106, ""); /* operand count mismatch */
return;
void listbps()
{
- int i, cnt = 0;
+ int cnt = 0;
BPSLIST *p = NULL;
fprintf(stdout, "List of breakpoints\n");
- for(i = 0; i < BPSTABSIZE; i++) {
+ for(int i = 0; i < BPSTABSIZE; i++) {
for(p = bps[i]; p != NULL; p = p->next) {
fprintf(stdout, "#%04X\n", p->adr);
cnt++;
char *word2n(WORD word)
{
enum {
- MAXLEN = 5, /* WORD値を10進数で表したときの最大桁数 */
+ MAXLEN = 5, /* WORD値を10進数で表したときの最大けた数 */
};
- char *n = malloc_chk(MAXLEN + 1, "word2n.n"), tmp;
- int i = 0, j;
+ char *n = malloc_chk(MAXLEN + 1, "word2n.n");
+ int d = 0; /* けた数 */
do{
- n[i++] = word % 10 + '0';
+ n[d++] = word % 10 + '0';
} while((word /= 10) > 0);
- for(j = 0; j < i; j++) {
- tmp = n[j];
- n[j] = n[(i-1)-j];
- n[(i-1)-j] = tmp;
+ for(int i = 0; i < d; i++) {
+ char tmp = n[i];
+ n[i] = n[(d-1)-i];
+ n[(d-1)-i] = tmp;
}
- n[j] = '\0';
+ n[d] = '\0';
return n;
}