Changeset da680b4b in mainline for uspace/lib/c/generic/str.c


Ignore:
Timestamp:
2018-07-06T17:18:28Z (7 years ago)
Author:
Jiri Svoboda <jiri@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
6419c6e
Parents:
9ba040a
Message:

Don't automatically mount writable filesystems on ATA hard drives. Better be safe than sorry. (But no way to override yet.)

File:
1 edited

Legend:

Unmodified
Added
Removed
  • uspace/lib/c/generic/str.c

    r9ba040a rda680b4b  
    11341134                        return (char *) (str + last);
    11351135                last = off;
     1136        }
     1137
     1138        return NULL;
     1139}
     1140
     1141/** Find first occurence of substring in string.
     1142 *
     1143 * @param hs  Haystack (string)
     1144 * @param n   Needle (substring to look for)
     1145 *
     1146 * @return Pointer to character in @a hs or @c NULL if not found.
     1147 */
     1148char *str_str(const char *hs, const char *n)
     1149{
     1150        size_t off = 0;
     1151
     1152        if (str_lcmp(hs, n, str_length(n)) == 0)
     1153                return (char *)hs;
     1154
     1155        while (str_decode(hs, &off, STR_NO_LIMIT) != 0) {
     1156                if (str_lcmp(hs + off, n, str_length(n)) == 0)
     1157                        return (char *)(hs + off);
    11361158        }
    11371159
Note: See TracChangeset for help on using the changeset viewer.