Changeset 3472845 for functions.c


Ignore:
Timestamp:
Feb 11, 2011, 5:18:45 PM (10 years ago)
Author:
Anders Kaseorg <andersk@mit.edu>
Branches:
master, release-1.8, release-1.9
Children:
8a97586
Parents:
d4927a7
git-author:
Anders Kaseorg <andersk@mit.edu> (08/27/09 00:56:39)
git-committer:
Anders Kaseorg <andersk@mit.edu> (02/11/11 17:18:45)
Message:
Replace owl_sprintf with g_strdup_printf.

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

Legend:

Unmodified
Added
Removed
  • functions.c

    rd4927a7 r3472845  
    9696  owl_fmtext *fm = user_data;
    9797  owl_timer *timer = data;
    98   char *str = owl_sprintf("- %s: in %d seconds",
    99                           timer->name ? timer->name : "(unnamed)",
    100                           (int)(timer->time - time(NULL)));
     98  char *str = g_strdup_printf("- %s: in %d seconds",
     99                              timer->name ? timer->name : "(unnamed)",
     100                              (int)(timer->time - time(NULL)));
    101101  owl_fmtext_append_normal(fm, str);
    102102  g_free(str);
    103103  if (timer->interval) {
    104     str = owl_sprintf(", repeat every %d seconds", timer->interval);
     104    str = g_strdup_printf(", repeat every %d seconds", timer->interval);
    105105    owl_fmtext_append_normal(fm, str);
    106106    g_free(str);
     
    133133    desc = "???";
    134134  }
    135   s = owl_sprintf("%-20s - %s%s", name,
    136                   0==owl_style_validate(style)?"":"[INVALID] ",
    137                   desc);
     135  s = g_strdup_printf("%-20s - %s%s", name,
     136                      0 == owl_style_validate(style) ? "" : "[INVALID] ",
     137                      desc);
    138138  return s;
    139139}
     
    216216        char *perlquickstart = owl_perlconfig_execute("BarnOwl::Hooks::_get_quickstart()");
    217217        if (perlquickstart) {
    218             char *result = owl_sprintf("%s%s", message, perlquickstart);
     218            char *result = g_strdup_printf("%s%s", message, perlquickstart);
    219219            owl_function_adminmsg("BarnOwl Quickstart", result);
    220220            g_free(result);
     
    311311                                   owl_global_get_msg_history(&g));
    312312  owl_editwin_set_dotsend(e);
    313   s = owl_sprintf("----> %s\n", line);
     313  s = g_strdup_printf("----> %s\n", line);
    314314  owl_editwin_set_locktext(e, s);
    315315  g_free(s);
     
    354354  /* TODO: We probably actually want an owl_aimwrite object like
    355355   * owl_zwrite. */
    356   char *line = owl_sprintf("aimwrite %s", to);
     356  char *line = g_strdup_printf("aimwrite %s", to);
    357357  owl_function_write_setup("message");
    358358  owl_function_start_edit_win(line,
     
    438438  old_msg = g_strdup(owl_zwrite_get_message(z));
    439439
    440   zcrypt = owl_sprintf("%s/zcrypt", owl_get_bindir());
     440  zcrypt = g_strdup_printf("%s/zcrypt", owl_get_bindir());
    441441  argv[0] = "zcrypt";
    442442  argv[1] = "-E";
     
    19911991
    19921992  buff = skiptokens(buff, 1);
    1993   newbuff = owl_sprintf("%s%s", buff, redirect);
     1993  newbuff = g_strdup_printf("%s%s", buff, redirect);
    19941994
    19951995  if (type == OWL_OUTPUT_POPUP) {
     
    21932193    newname=g_strdup(filtername+4);
    21942194  } else {
    2195     newname=owl_sprintf("not-%s", filtername);
     2195    newname=g_strdup_printf("not-%s", filtername);
    21962196  }
    21972197
     
    22452245  }
    22462246  tmp = owl_filter_print(f);
    2247   buff = owl_sprintf("%s: %s", owl_filter_get_name(f), tmp);
     2247  buff = g_strdup_printf("%s: %s", owl_filter_get_name(f), tmp);
    22482248  owl_function_popless_text(buff);
    22492249  g_free(buff);
     
    23052305  /* name for the filter */
    23062306  if (!instance) {
    2307     filtname = owl_sprintf("%sclass-%s", related ? "related-" : "", class);
    2308   } else {
    2309     filtname = owl_sprintf("%sclass-%s-instance-%s", related ? "related-" : "", class, instance);
     2307    filtname = g_strdup_printf("%sclass-%s", related ? "related-" : "", class);
     2308  } else {
     2309    filtname = g_strdup_printf("%sclass-%s-instance-%s", related ? "related-" : "", class, instance);
    23102310  }
    23112311  /* downcase it */
     
    23792379  /* name for the filter */
    23802380  shortuser = short_zuser(longuser);
    2381   filtname = owl_sprintf("user-%s", shortuser);
     2381  filtname = g_strdup_printf("user-%s", shortuser);
    23822382  g_free(shortuser);
    23832383
     
    24252425
    24262426  /* name for the filter */
    2427   filtname=owl_sprintf("aimuser-%s", user);
     2427  filtname=g_strdup_printf("aimuser-%s", user);
    24282428
    24292429  /* if it already exists then go with it.  This lets users override */
     
    24352435  escuser = owl_text_quote(user, OWL_REGEX_QUOTECHARS, OWL_REGEX_QUOTEWITH);
    24362436
    2437   argbuff = owl_sprintf(
     2437  argbuff = g_strdup_printf(
    24382438      "( type ^aim$ and ( ( sender ^%1$s$ and recipient ^%2$s$ ) or "
    24392439      "( sender ^%2$s$ and recipient ^%1$s$ ) ) )",
     
    24622462
    24632463  /* name for the filter */
    2464   filtname=owl_sprintf("type-%s", type);
     2464  filtname=g_strdup_printf("type-%s", type);
    24652465
    24662466  /* if it already exists then go with it.  This lets users override */
     
    25212521  ccs = owl_message_get_attribute_value(m, "zephyr_ccs");
    25222522
    2523   filtname = owl_sprintf("conversation-%s", ccs);
     2523  filtname = g_strdup_printf("conversation-%s", ccs);
    25242524  owl_text_tr(filtname, ' ', '-');
    25252525
     
    27632763
    27642764  for(i = 8; i < COLORS; ++i) {
    2765     char* str1 = owl_sprintf("%4i:     ",i);
    2766     char* str2 = owl_sprintf("%i\n",i);
     2765    char* str1 = g_strdup_printf("%4i:     ",i);
     2766    char* str2 = g_strdup_printf("%i\n",i);
    27672767    owl_fmtext_append_normal(&fm,str1);
    27682768    owl_fmtext_append_normal_color(&fm, str2, i, OWL_COLOR_DEFAULT);
     
    33923392  date[strlen(date)-1]='\0';
    33933393
    3394   buff = owl_sprintf("%s %s", date, string);
     3394  buff = g_strdup_printf("%s %s", date, string);
    33953395
    33963396  owl_errqueue_append_err(owl_global_get_errqueue(&g), buff);
Note: See TracChangeset for help on using the changeset viewer.