Mercurial > pidgin
comparison libpurple/util.c @ 27268:c0075538109b
Formatting changes, no functionality.
* Return early if html is null (instead of indenting everything one
level)
* No need to set ret=g_string_append(ret, blah);
author | Mark Doliner <mark@kingant.net> |
---|---|
date | Fri, 03 Jul 2009 09:05:51 +0000 |
parents | e28b627be482 |
children | 33734bb78c9f |
comparison
equal
deleted
inserted
replaced
27267:46e182c1c14f | 27268:c0075538109b |
---|---|
2397 | 2397 |
2398 } | 2398 } |
2399 return g_string_free(ret, FALSE); | 2399 return g_string_free(ret, FALSE); |
2400 } | 2400 } |
2401 | 2401 |
2402 char * | 2402 char *purple_unescape_html(const char *html) |
2403 purple_unescape_html(const char *html) { | 2403 { |
2404 if (html != NULL) { | 2404 GString *ret; |
2405 const char *c = html; | 2405 const char *c = html; |
2406 GString *ret = g_string_new(""); | 2406 |
2407 while (*c) { | 2407 if (html == NULL) |
2408 int len; | 2408 return NULL; |
2409 const char *ent; | 2409 |
2410 | 2410 ret = g_string_new(""); |
2411 if ((ent = purple_markup_unescape_entity(c, &len)) != NULL) { | 2411 while (*c) { |
2412 ret = g_string_append(ret, ent); | 2412 int len; |
2413 c += len; | 2413 const char *ent; |
2414 } else if (!strncmp(c, "<br>", 4)) { | 2414 |
2415 ret = g_string_append_c(ret, '\n'); | 2415 if ((ent = purple_markup_unescape_entity(c, &len)) != NULL) { |
2416 c += 4; | 2416 g_string_append(ret, ent); |
2417 } else { | 2417 c += len; |
2418 ret = g_string_append_c(ret, *c); | 2418 } else if (!strncmp(c, "<br>", 4)) { |
2419 c++; | 2419 g_string_append_c(ret, '\n'); |
2420 } | 2420 c += 4; |
2421 } | 2421 } else { |
2422 return g_string_free(ret, FALSE); | 2422 g_string_append_c(ret, *c); |
2423 } | 2423 c++; |
2424 | 2424 } |
2425 return NULL; | 2425 } |
2426 | |
2427 return g_string_free(ret, FALSE); | |
2426 } | 2428 } |
2427 | 2429 |
2428 char * | 2430 char * |
2429 purple_markup_slice(const char *str, guint x, guint y) | 2431 purple_markup_slice(const char *str, guint x, guint y) |
2430 { | 2432 { |