comparison libpurple/protocols/jabber/buddy.c @ 21015:787b3897ba9f

Patch from Andrew Gaul to constify a bunch of static variables to reduce the amount of writable memory +08108000 12K rwx-- /local/local/bin/pidgin -08107000 16K rwx-- /local/local/bin/pidgin +005bf000 20K rwx-- /local/local/lib/libpurple.so.0.2.1 -005be000 24K rwx-- /local/local/lib/libpurple.so.0.2.1
author Ka-Hing Cheung <khc@hxbc.us>
date Fri, 26 Oct 2007 04:59:23 +0000
parents c1d3d25e8c49
children 0d6e582f2679
comparison
equal deleted inserted replaced
21014:0314cb293463 21015:787b3897ba9f
277 int visible; /* should entry field be "visible?" */ 277 int visible; /* should entry field be "visible?" */
278 int editable; /* should entry field be editable? */ 278 int editable; /* should entry field be editable? */
279 char *tag; /* tag text */ 279 char *tag; /* tag text */
280 char *ptag; /* parent tag "path" text */ 280 char *ptag; /* parent tag "path" text */
281 char *url; /* vCard display format if URL */ 281 char *url; /* vCard display format if URL */
282 } vcard_template_data[] = { 282 } const vcard_template_data[] = {
283 {N_("Full Name"), NULL, TRUE, TRUE, "FN", NULL, NULL}, 283 {N_("Full Name"), NULL, TRUE, TRUE, "FN", NULL, NULL},
284 {N_("Family Name"), NULL, TRUE, TRUE, "FAMILY", "N", NULL}, 284 {N_("Family Name"), NULL, TRUE, TRUE, "FAMILY", "N", NULL},
285 {N_("Given Name"), NULL, TRUE, TRUE, "GIVEN", "N", NULL}, 285 {N_("Given Name"), NULL, TRUE, TRUE, "GIVEN", "N", NULL},
286 {N_("Nickname"), NULL, TRUE, TRUE, "NICKNAME", NULL, NULL}, 286 {N_("Nickname"), NULL, TRUE, TRUE, "NICKNAME", NULL, NULL},
287 {N_("URL"), NULL, TRUE, TRUE, "URL", NULL, "<A HREF=\"%s\">%s</A>"}, 287 {N_("URL"), NULL, TRUE, TRUE, "URL", NULL, "<A HREF=\"%s\">%s</A>"},
309 * The "vCard" tag's attribute list... 309 * The "vCard" tag's attribute list...
310 */ 310 */
311 struct tag_attr { 311 struct tag_attr {
312 char *attr; 312 char *attr;
313 char *value; 313 char *value;
314 } vcard_tag_attr_list[] = { 314 } const vcard_tag_attr_list[] = {
315 {"prodid", "-//HandGen//NONSGML vGen v1.0//EN"}, 315 {"prodid", "-//HandGen//NONSGML vGen v1.0//EN"},
316 {"version", "2.0", }, 316 {"version", "2.0", },
317 {"xmlns", "vcard-temp", }, 317 {"xmlns", "vcard-temp", },
318 {NULL, NULL}, 318 {NULL, NULL},
319 }; 319 };
335 /* 335 /*
336 * If the parent tag wasn't specified, see if we can get it 336 * If the parent tag wasn't specified, see if we can get it
337 * from the vCard template struct. 337 * from the vCard template struct.
338 */ 338 */
339 if(parent_tag == NULL) { 339 if(parent_tag == NULL) {
340 struct vcard_template *vc_tp = vcard_template_data; 340 const struct vcard_template *vc_tp = vcard_template_data;
341 341
342 while(vc_tp->label != NULL) { 342 while(vc_tp->label != NULL) {
343 if(strcmp(vc_tp->tag, new_tag) == 0) { 343 if(strcmp(vc_tp->tag, new_tag) == 0) {
344 parent_tag = vc_tp->ptag; 344 parent_tag = vc_tp->ptag;
345 break; 345 break;
393 void jabber_set_info(PurpleConnection *gc, const char *info) 393 void jabber_set_info(PurpleConnection *gc, const char *info)
394 { 394 {
395 JabberIq *iq; 395 JabberIq *iq;
396 JabberStream *js = gc->proto_data; 396 JabberStream *js = gc->proto_data;
397 xmlnode *vc_node; 397 xmlnode *vc_node;
398 struct tag_attr *tag_attr; 398 const struct tag_attr *tag_attr;
399 399
400 /* if we have't grabbed the remote vcard yet, we can't 400 /* if we have't grabbed the remote vcard yet, we can't
401 * assume that what we have here is correct */ 401 * assume that what we have here is correct */
402 if(!js->vcard_fetched) 402 if(!js->vcard_fetched)
403 return; 403 return;
612 xmlnode *vc_node; 612 xmlnode *vc_node;
613 PurpleRequestField *field; 613 PurpleRequestField *field;
614 const char *text; 614 const char *text;
615 char *p; 615 char *p;
616 const struct vcard_template *vc_tp; 616 const struct vcard_template *vc_tp;
617 struct tag_attr *tag_attr; 617 const struct tag_attr *tag_attr;
618 618
619 vc_node = xmlnode_new("vCard"); 619 vc_node = xmlnode_new("vCard");
620 620
621 for(tag_attr = vcard_tag_attr_list; tag_attr->attr != NULL; ++tag_attr) 621 for(tag_attr = vcard_tag_attr_list; tag_attr->attr != NULL; ++tag_attr)
622 xmlnode_set_attrib(vc_node, tag_attr->attr, tag_attr->value); 622 xmlnode_set_attrib(vc_node, tag_attr->attr, tag_attr->value);