X-Git-Url: https://git.gag.com/?a=blobdiff_plain;f=src%2FSDCCpeeph.c;h=daf96c3ae5073b396a1b15ffbe10566117f51a85;hb=3929272bc523af272364e741f5a4565c97c47932;hp=a831e9f404a386a60de61962a89605bf0b0aa424;hpb=88911079e8f9eb7fb3dfb08c32e805bb7b5e62c1;p=fw%2Fsdcc diff --git a/src/SDCCpeeph.c b/src/SDCCpeeph.c index a831e9f4..daf96c3a 100644 --- a/src/SDCCpeeph.c +++ b/src/SDCCpeeph.c @@ -24,6 +24,7 @@ -------------------------------------------------------------------------*/ #include "common.h" +#include "dbuf_string.h" #define ISCHARDIGIT(c) isdigit((unsigned char)c) #define ISCHARSPACE(c) isspace((unsigned char)c) @@ -308,10 +309,10 @@ FBYNAME (okToRemoveSLOC) /*-----------------------------------------------------------------*/ FBYNAME (deadMove) { - char *op = hTabItemWithKey (vars, 1); + const char *reg = hTabItemWithKey (vars, 1); if (port->peep.deadMove) - return port->peep.deadMove (op, currPl, head); + return port->peep.deadMove (reg, currPl, head); fprintf (stderr, "Function deadMove not initialized in port structure\n"); return FALSE; @@ -1198,14 +1199,11 @@ callFuncByName (char *fname, /* printLine - prints a line chain into a given file */ /*-----------------------------------------------------------------*/ void -printLine (lineNode * head, FILE * of) +printLine (lineNode * head, struct dbuf_s * oBuf) { iCode *last_ic = NULL; bool debug_iCode_tracking = (getenv("DEBUG_ICODE_TRACKING")!=NULL); - if (!of) - of = stdout; - while (head) { if (head->ic!=last_ic) @@ -1214,23 +1212,23 @@ printLine (lineNode * head, FILE * of) if (debug_iCode_tracking) { if (head->ic) - fprintf (of, "; block = %d, seq = %d\n", + dbuf_printf (oBuf, "; block = %d, seq = %d\n", head->ic->block, head->ic->seq); else - fprintf (of, "; iCode lost\n"); + dbuf_append_str (oBuf, "; iCode lost\n"); } } /* don't indent comments & labels */ if (head->line && (head->isComment || head->isLabel)) { - fprintf (of, "%s\n", head->line); + dbuf_printf (oBuf, "%s\n", head->line); } else { if (head->isInline && *head->line=='#') { // comment out preprocessor directives in inline asm - fprintf (of, ";"); + dbuf_append_char (oBuf, ';'); } - fprintf (of, "\t%s\n", head->line); + dbuf_printf (oBuf, "\t%s\n", head->line); } head = head->next; } @@ -1274,7 +1272,7 @@ newPeepRule (lineNode * match, /* newLineNode - creates a new peep line */ /*-----------------------------------------------------------------*/ lineNode * -newLineNode (char *line) +newLineNode (const char *line) { lineNode *pl;