Show
Ignore:
Timestamp:
2000-01-10 02:35:48 (9 years ago)
Author:
Thomas Roessler <roessler@…>
Branch:
HEAD
Message:

Add (and use) a function mutt_str_replace, which essentially
replaces the sequence:

safe_free (&s);
s = safe_strdup (t);

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • compose.c

    r1426 r1431  
    153153    { 
    154154      snprintf (input_signas, sizeof (input_signas), "0x%s", pgp_keyid (p)); 
    155       safe_free((void **) &PgpSignAs);      PgpSignAs = safe_strdup (input_signas); 
    156       safe_free((void **) &PgpSignMicalg);  PgpSignMicalg = safe_strdup (pgp_pkalg_to_mic (p->algorithm)); 
     155      mutt_str_replace (&PgpSignAs, input_signas); 
     156      mutt_str_replace (&PgpSignMicalg, pgp_pkalg_to_mic (p->algorithm)); 
    157157      pgp_free_key (&p); 
    158158       
     
    189189        } 
    190190        else  
    191         { 
    192           safe_free ((void **) &PgpSignMicalg); 
    193           PgpSignMicalg = safe_strdup (input_micalg); 
    194         } 
     191          mutt_str_replace (&PgpSignMicalg, input_micalg); 
    195192      } 
    196193    } 
     
    488485        if (mutt_get_field ("Subject: ", buf, sizeof (buf), 0) == 0) 
    489486        { 
    490           safe_free ((void **) &msg->env->subject); 
    491           msg->env->subject = safe_strdup (buf); 
     487          mutt_str_replace (&msg->env->subject, buf); 
    492488          move (HDR_SUBJECT, HDR_XOFFSET); 
    493489          clrtoeol (); 
     
    826822        if (mutt_get_field ("Description: ", buf, sizeof (buf), 0) == 0) 
    827823        { 
    828           safe_free ((void **) &idx[menu->current]->content->description); 
    829           idx[menu->current]->content->description = safe_strdup (buf); 
     824          mutt_str_replace (&idx[menu->current]->content->description, buf); 
    830825          menu->redraw = REDRAW_CURRENT; 
    831826        } 
     
    965960            break; 
    966961           
    967           safe_free ((void **) &idx[menu->current]->content->filename); 
    968           idx[menu->current]->content->filename = safe_strdup (fname); 
     962          mutt_str_replace (&idx[menu->current]->content->filename, fname); 
    969963          menu->redraw = REDRAW_CURRENT; 
    970964 
     
    10371031 
    10381032          idx[menu->current]->content->type = itype; 
    1039           safe_free ((void **) &idx[menu->current]->content->subtype); 
    1040           idx[menu->current]->content->subtype = safe_strdup (p); 
     1033          mutt_str_replace (&idx[menu->current]->content->subtype, p); 
    10411034          idx[menu->current]->content->unlink = 1; 
    10421035          menu->redraw |= REDRAW_INDEX | REDRAW_STATUS;