dis_sql/src/esql.cxx
/* The following function is used to create a single string from the
 * text of a number of tokens.  It is used for creating pathnames for
 * inclusion directives, since the lexer breaks them up during its
 * normal processing.  The string that it returns has been malloced and
 * must be freed by the caller.
 */
The following function is used to create a single string from the
text of a number of tokens.  It is used for creating pathnames for
inclusion directives, since the lexer breaks them up during its
normal processing.  The string that it returns has been malloced and
must be freed by the caller.
The following function is used to create a single string from the text of a number of tokens . It is used for creating pathnames for inclusion directives since the lexer breaks them up during its normal processing . The string that it returns has been malloced and must be freed by the caller .
static char* concat_tokens(sqltype tokens) {
    unsigned int i;
    token* tp;
    size_t sz  = 0;
    char* result;
    char* p;
    for (i = tokens.start_token; i <= tokens.end_token; i++) {
        tp = get_token(i);
        if (tp) {
            sz += strlen(tp->text);
        }
    }
#ifdef ISO_CPP_HEADERS
    result = (char*)std::malloc(sz + 1);
#else
    result = (char*)malloc(sz + 1);
#endif
    p = result;
    for (i = tokens.start_token; i <= tokens.end_token; i++) {
        tp = get_token(i);
        if (tp) {
            strcpy(p, tp->text);
            p += strlen(tp->text);
        }
    }
    *p = 0;
    return result;
}
static char * concat_tokens ( sqltype tokens ) { unsigned int i ; token * tp ; size_t sz = 0 ; char * result ; char * p ; for ( i = tokens . start_token ; i <= tokens . end_token ; i ++ ) { tp = get_token ( i ) ; if ( tp ) { sz += strlen ( tp -> text ) ; } } #ifdef ISO_CPP_HEADERS result = ( char * ) std :: malloc ( sz + 1 ) ; #else result = ( char * ) malloc ( sz + 1 ) ; #endif p = result ; for ( i = tokens . start_token ; i <= tokens . end_token ; i ++ ) { tp = get_token ( i ) ; if ( tp ) { strcpy ( p , tp -> text ) ; p += strlen ( tp -> text ) ; } } * p = 0 ; return result ; }
The following function is used to create a single string from the
 text of a number of tokens.
The following function is used to create a single string from the text of a number of tokens .