Changeset 3fbce97 for lib/misc.c


Ignore:
Timestamp:
2016-09-24T20:14:34Z (8 years ago)
Author:
Wilmer van der Gaast <wilmer@…>
Children:
ba52ac5
Parents:
63cad66 (diff), 82cb190 (diff)
Note: this is a merge changeset, the changes displayed below correspond to the merge itself.
Use the (diff) links above to see all the changes relative to each parent.
Message:

Merge branch 'master' into parson

File:
1 edited

Legend:

Unmodified
Added
Removed
  • lib/misc.c

    r63cad66 r3fbce97  
    187187                                } else if (g_strncasecmp(cs + 1, "br", taglen) == 0) {
    188188                                        *(s++) = '\n';
     189                                } else if (g_strncasecmp(cs + 1, "br/", taglen) == 0) {
     190                                        *(s++) = '\n';
     191                                } else if (g_strncasecmp(cs + 1, "br /", taglen) == 0) {
     192                                        *(s++) = '\n';
    189193                                }
    190194                                in++;
     
    295299
    296300/* Warning: This one explodes the string. Worst-cases can make the string 3x its original size! */
    297 /* This fuction is safe, but make sure you call it safely as well! */
     301/* This function is safe, but make sure you call it safely as well! */
    298302void http_encode(char *s)
    299303{
     
    767771}
    768772
     773/* Filters all the characters in 'blacklist' replacing them with 'replacement'.
     774 * Modifies the string in-place and returns the string itself.
     775 * For the opposite, use g_strcanon() */
     776char *str_reject_chars(char *string, const char *reject, char replacement)
     777{
     778        char *c = string;
     779
     780        while (*c) {
     781                c += strcspn(c, reject);
     782                if (*c) {
     783                        *c = replacement;
     784                }
     785        }
     786
     787        return string;
     788}
Note: See TracChangeset for help on using the changeset viewer.