コード例 #1
0
ファイル: ass.c プロジェクト: OneDream/faplayer
static char *next_token(char **str)
{
    char *p = *str;
    char *start;
    skip_spaces(&p);
    if (*p == '\0') {
        *str = p;
        return 0;
    }
    start = p;                  // start of the token
    for (; (*p != '\0') && (*p != ','); ++p) {
    }
    if (*p == '\0') {
        *str = p;               // eos found, str will point to '\0' at exit
    } else {
        *p = '\0';
        *str = p + 1;           // ',' found, str will point to the next char (beginning of the next token)
    }
    --p;                        // end of current token
    rskip_spaces(&p, start);
    if (p < start)
        p = start;              // empty token
    else
        ++p;                    // the first space character, or '\0'
    *p = '\0';
    return start;
}
コード例 #2
0
ファイル: ass_parse.c プロジェクト: imclab/libass
static inline void push_arg(struct arg *args, int *nargs, char *start, char *end)
{
    if (*nargs <= MAX_VALID_NARGS) {
        rskip_spaces(&end, start);
        if (end > start) {
            args[*nargs] = (struct arg) {start, end};
            ++*nargs;
        }