asm/lex.c
char *token_data(const struct Token *token, char *buf, usize n) {
    assert(token->data);

    if (buf == NULL) {
        buf = asmalloc(token->len + 1);
    } else if (n < token->len + 1) {
        return NULL;
    }

    memcpy(buf, token->data, token->len);
    buf[token->len] = '\0';
    return buf;
}
// retrieves data from token into buf of size n. if buf is NULL, a buffer of
// adequate size is asmalloc'd and returned. returns NULL on failure.
retrieves data from token into buf of size n. if buf is NULL, a buffer of
adequate size is asmalloc'd and returned. returns NULL on failure.
retrieves data from token into buf of size n . if buf is NULL a buffer of adequate size is asmalloc ' d and returned . returns NULL on failure .
char *token_data(const struct Token *token, char *buf, usize n) {
    assert(token->data);
    if (buf == NULL) {
        buf = asmalloc(token->len + 1);
    } else if (n < token->len + 1) {
        return NULL;
    }
    memcpy(buf, token->data, token->len);
    buf[token->len] = '\0';
    return buf;
}
char * token_data ( const struct Token * token , char * buf , usize n ) { assert ( token -> data ) ; if ( buf == NULL ) { buf = asmalloc ( token -> len + 1 ) ; } else if ( n < token -> len + 1 ) { return NULL ; } memcpy ( buf , token -> data , token -> len ) ; buf [ token -> len ] = ' \0 ' ; return buf ; }
retrieves data from token into buf of size n. if buf is NULL, a buffer of
adequate size is asmalloc'd and returned.
retrieves data from token into buf of size n . if buf is NULL a buffer of adequate size is asmalloc ' d and returned .