Changeset e3a75ed for zephyr.c


Ignore:
Timestamp:
Mar 5, 2011, 3:25:29 PM (10 years ago)
Author:
David Benjamin <davidben@mit.edu>
Branches:
master, release-1.8, release-1.9
Children:
488913a
Parents:
010a951
git-author:
David Benjamin <davidben@mit.edu> (02/28/11 18:45:28)
git-committer:
David Benjamin <davidben@mit.edu> (03/05/11 15:25:29)
Message:
Replace the remaining snprintfs with g_strdup_printf

Hard-coded buffer sizes are silly.
File:
1 edited

Legend:

Unmodified
Added
Removed
  • zephyr.c

    rbb85767 re3a75ed  
    762762    }
    763763  } else if (!strcmp(retnotice->z_message, ZSRVACK_NOTSENT)) {
    764     #define BUFFLEN 1024
    765764    if (retnotice->z_recipient == NULL
    766765        || *retnotice->z_recipient == 0
    767766        || *retnotice->z_recipient == '@') {
    768       char buff[BUFFLEN];
     767      char *buff;
    769768      owl_function_error("No one subscribed to class %s", retnotice->z_class);
    770       snprintf(buff, BUFFLEN, "Could not send message to class %s: no one subscribed.\n", retnotice->z_class);
     769      buff = g_strdup_printf("Could not send message to class %s: no one subscribed.\n", retnotice->z_class);
    771770      owl_function_adminmsg("", buff);
     771      g_free(buff);
    772772    } else {
    773       char buff[BUFFLEN];
     773      char *buff;
    774774      owl_zwrite zw;
    775775      char *realm;
     
    783783       */
    784784      if(strcasecmp(retnotice->z_class, "message")) {
    785         snprintf(buff, BUFFLEN,
     785        buff = g_strdup_printf(
    786786                 "Could not send message to %s: "
    787787                 "not logged in or subscribing to class %s, instance %s.\n",
     
    790790                 retnotice->z_class_inst);
    791791      } else if(strcasecmp(retnotice->z_class_inst, "personal")) {
    792         snprintf(buff, BUFFLEN,
     792        buff = g_strdup_printf(
    793793                 "Could not send message to %s: "
    794794                 "not logged in or subscribing to instance %s.\n",
     
    796796                 retnotice->z_class_inst);
    797797      } else {
    798         snprintf(buff, BUFFLEN,
     798        buff = g_strdup_printf(
    799799                 "Could not send message to %s: "
    800800                 "not logged in or subscribing to messages.\n",
     
    820820
    821821      owl_zwrite_cleanup(&zw);
     822      g_free(buff);
    822823      g_free(tmp);
    823824    }
Note: See TracChangeset for help on using the changeset viewer.