Mercurial > pidgin.yaz
comparison src/util.c @ 2956:b68c648618a3
[gaim-migrate @ 2969]
I Love Rock & Roll....
committer: Tailor Script <tailor@pidgin.im>
author | Rob Flynn <gaim@robflynn.com> |
---|---|
date | Sun, 17 Feb 2002 18:08:12 +0000 |
parents | cd23279122ed |
children | a7e03c5d2205 |
comparison
equal
deleted
inserted
replaced
2955:8b03506b8c1e | 2956:b68c648618a3 |
---|---|
910 } | 910 } |
911 } | 911 } |
912 } | 912 } |
913 | 913 |
914 | 914 |
915 /* | |
916 * Like strncpy_withhtml (above), but malloc()'s the necessary space | |
917 * | |
918 * The caller is responsible for freeing the space pointed to by the | |
919 * return value. | |
920 */ | |
921 | |
922 gchar *strdup_withhtml(const gchar *src) | |
923 { | |
924 char *sp, *dest; | |
925 gulong destsize; | |
926 | |
927 /* | |
928 * All we need do is multiply the number of newlines by 3 (the | |
929 * additional length of "<BR>" over "\n"), account for the | |
930 * terminator, malloc the space and call strncpy_withhtml. | |
931 */ | |
932 for(destsize = 0, sp = src; (sp = strchr(sp, '\n')) != NULL; ++sp, ++destsize) | |
933 ; | |
934 destsize *= 3; | |
935 destsize += strlen(src) + 1; | |
936 dest = g_malloc(destsize); | |
937 strncpy_withhtml(dest, src, destsize); | |
938 | |
939 return(dest); | |
940 } | |
941 | |
915 void away_on_login(char *mesg) | 942 void away_on_login(char *mesg) |
916 { | 943 { |
917 GSList *awy = away_messages; | 944 GSList *awy = away_messages; |
918 struct away_message *a, *message = NULL; | 945 struct away_message *a, *message = NULL; |
919 | 946 |