MCPcopy Create free account
hub / github.com/audacity/audacity / set_table_name

Function set_table_name

lib-src/sqlite/shell.c:12583–12606  ·  view source on GitHub ↗

** Set the destination table field of the ShellState structure to ** the name of the table given. Escape any quote characters in the ** table name. */

Source from the content-addressed store, hash-verified

12581** table name.
12582*/
12583static void set_table_name(ShellState *p, const char *zName){
12584 int i, n;
12585 char cQuote;
12586 char *z;
12587
12588 if( p->zDestTable ){
12589 free(p->zDestTable);
12590 p->zDestTable = 0;
12591 }
12592 if( zName==0 ) return;
12593 cQuote = quoteChar(zName);
12594 n = strlen30(zName);
12595 if( cQuote ) n += n+2;
12596 z = p->zDestTable = malloc( n+1 );
12597 if( z==0 ) shell_out_of_memory();
12598 n = 0;
12599 if( cQuote ) z[n++] = cQuote;
12600 for(i=0; zName[i]; i++){
12601 z[n++] = zName[i];
12602 if( zName[i]==cQuote ) z[n++] = cQuote;
12603 }
12604 if( cQuote ) z[n++] = cQuote;
12605 z[n] = 0;
12606}
12607
12608
12609/*

Callers 2

do_meta_commandFunction · 0.85
wmainFunction · 0.85

Calls 4

freeFunction · 0.85
quoteCharFunction · 0.85
strlen30Function · 0.85
shell_out_of_memoryFunction · 0.85

Tested by

no test coverage detected