Changeset 96828e4 for fmtext.c


Ignore:
Timestamp:
Feb 11, 2011, 4:31:33 PM (10 years ago)
Author:
Anders Kaseorg <andersk@mit.edu>
Branches:
master, release-1.8, release-1.9
Children:
35b6eb9
Parents:
9518a85
git-author:
Anders Kaseorg <andersk@mit.edu> (08/27/09 00:51:45)
git-committer:
Anders Kaseorg <andersk@mit.edu> (02/11/11 16:31:33)
Message:
Replace owl_malloc with g_new and g_new0.

Signed-off-by: Anders Kaseorg <andersk@mit.edu>
Reviewed-by: Karl Ramm <kcr@mit.edu>
File:
1 edited

Legend:

Unmodified
Added
Removed
  • fmtext.c

    r099597c r96828e4  
    640640    } else if (ptr[0]=='@') {
    641641      /* add the text up to this point then deal with the stack */
    642       buff=owl_malloc(ptr-txtptr+20);
     642      buff=g_new(char, ptr-txtptr+20);
    643643      strncpy(buff, txtptr, ptr-txtptr);
    644644      buff[ptr-txtptr]='\0';
     
    675675      /* check what command we've got, push it on the stack, start
    676676         using it, and continue ... unless it's a color command */
    677       buff=owl_malloc(tmpptr-ptr+20);
     677      buff=g_new(char, tmpptr-ptr+20);
    678678      strncpy(buff, ptr, tmpptr-ptr);
    679679      buff[tmpptr-ptr]='\0';
     
    738738
    739739          /* grab the color name */
    740           buff=owl_malloc(tmpptr-txtptr+20);
     740          buff=g_new(char, tmpptr-txtptr+20);
    741741          strncpy(buff, txtptr, tmpptr-txtptr);
    742742          buff[tmpptr-txtptr]='\0';
     
    765765    } else if (ptr[0]=='}' || ptr[0]==']' || ptr[0]==')' || ptr[0]=='>') {
    766766      /* add the text up to this point first */
    767       buff=owl_malloc(ptr-txtptr+20);
     767      buff=g_new(char, ptr-txtptr+20);
    768768      strncpy(buff, txtptr, ptr-txtptr);
    769769      buff[ptr-txtptr]='\0';
     
    776776      /* first, if the stack is empty we must bail (just print and go) */
    777777      if (stacksize==0) {
    778         buff=owl_malloc(5);
     778        buff=g_new(char, 5);
    779779        buff[0]=ptr[0];
    780780        buff[1]='\0';
     
    802802      } else {
    803803        /* otherwise print and continue */
    804         buff=owl_malloc(5);
     804        buff=g_new(char, 5);
    805805        buff[0]=ptr[0];
    806806        buff[1]='\0';
     
    812812    } else {
    813813      /* we've found an unattached opener, print everything and move on */
    814       buff=owl_malloc(ptr-txtptr+20);
     814      buff=g_new(char, ptr-txtptr+20);
    815815      strncpy(buff, txtptr, ptr-txtptr+1);
    816816      buff[ptr-txtptr+1]='\0';
     
    864864  short i;
    865865  /* The test is <= because we allocate COLORS+1 entries. */
    866   cpmgr->pairs = owl_malloc((COLORS+1) * sizeof(short*));
     866  cpmgr->pairs = g_new(short *, COLORS + 1);
    867867  for(i = 0; i <= COLORS; i++) {
    868     cpmgr->pairs[i] = owl_malloc((COLORS+1) * sizeof(short));
     868    cpmgr->pairs[i] = g_new(short, COLORS + 1);
    869869  }
    870870  owl_fmtext_reset_colorpairs(cpmgr);
Note: See TracChangeset for help on using the changeset viewer.