Branch: Tag:

2015-08-22

2015-08-22 18:35:10 by Per Hedbor <ph@opera.com>

Static:ified a lot of strings.

This is more or less all instances of push_text(static data here).

Left to do: make_shared_X_string(static data here). :)

59:      static void push_device( SANE_Device *d )   { -  push_text( "name" ); push_text( d->name ); -  push_text( "vendor" ); push_text( d->vendor ); -  push_text( "model" ); push_text( d->model ); +  push_static_text( "name" ); push_text( d->name ); +  push_static_text( "vendor" ); push_text( d->vendor ); +  push_static_text( "model" ); push_text( d->model );    ref_push_string( literal_type_string ); push_text( d->type );    f_aggregate_mapping( 8 );   }
112:   {    int i;    struct svalue *osp = sp; -  push_text( "name" ); +  push_static_text( "name" );    if( o->name )    push_text( o->name );    else    push_int( 0 ); -  push_text( "title" ); +  push_static_text( "title" );    if( o->title )    push_text( o->title );    else    push_int( 0 ); -  push_text( "desc" ); +  push_static_text( "desc" );    if( o->desc )    push_text( o->desc );    else
130:    ref_push_string( literal_type_string );    switch( o->type )    { -  case SANE_TYPE_BOOL: push_text( "boolean" ); break; +  case SANE_TYPE_BOOL: push_static_text( "boolean" ); break;    case SANE_TYPE_INT: ref_push_string( literal_int_string ); break;    case SANE_TYPE_FIXED: ref_push_string( literal_float_string ); break;    case SANE_TYPE_STRING: ref_push_string( literal_string_string ); break; -  case SANE_TYPE_BUTTON: push_text( "button" ); break; -  case SANE_TYPE_GROUP: push_text( "group" ); break; +  case SANE_TYPE_BUTTON: push_static_text( "button" ); break; +  case SANE_TYPE_GROUP: push_static_text( "group" ); break;    }       -  push_text( "unit" ); +  push_static_text( "unit" );    switch( o->unit )    { -  case SANE_UNIT_NONE: push_text( "none" ); break; -  case SANE_UNIT_PIXEL: push_text( "pixel" ); break; -  case SANE_UNIT_BIT: push_text( "bit" ); break; -  case SANE_UNIT_MM: push_text( "mm" ); break; -  case SANE_UNIT_DPI: push_text( "dpi" ); break; -  case SANE_UNIT_PERCENT: push_text( "percent" ); break; -  case SANE_UNIT_MICROSECOND: push_text( "microsecond" ); break; +  case SANE_UNIT_NONE: push_static_text( "none" ); break; +  case SANE_UNIT_PIXEL: push_static_text( "pixel" ); break; +  case SANE_UNIT_BIT: push_static_text( "bit" ); break; +  case SANE_UNIT_MM: push_static_text( "mm" ); break; +  case SANE_UNIT_DPI: push_static_text( "dpi" ); break; +  case SANE_UNIT_PERCENT: push_static_text( "percent" ); break; +  case SANE_UNIT_MICROSECOND: push_static_text( "microsecond" ); break;    }    -  push_text( "size" ); push_int( o->size ); +  push_static_text( "size" ); push_int( o->size );    -  push_text( "cap" ); +  push_static_text( "cap" );    {    struct svalue *osp = sp; -  if( o->cap & SANE_CAP_SOFT_SELECT ) push_text( "soft_select" ); -  if( o->cap & SANE_CAP_HARD_SELECT ) push_text( "hard_select" ); -  if( o->cap & SANE_CAP_EMULATED ) push_text( "emulated" ); -  if( o->cap & SANE_CAP_AUTOMATIC ) push_text( "automatic" ); -  if( o->cap & SANE_CAP_INACTIVE ) push_text( "inactive" ); -  if( o->cap & SANE_CAP_ADVANCED ) push_text( "advanced" ); +  if( o->cap & SANE_CAP_SOFT_SELECT ) push_static_text( "soft_select" ); +  if( o->cap & SANE_CAP_HARD_SELECT ) push_static_text( "hard_select" ); +  if( o->cap & SANE_CAP_EMULATED ) push_static_text( "emulated" ); +  if( o->cap & SANE_CAP_AUTOMATIC ) push_static_text( "automatic" ); +  if( o->cap & SANE_CAP_INACTIVE ) push_static_text( "inactive" ); +  if( o->cap & SANE_CAP_ADVANCED ) push_static_text( "advanced" );    f_aggregate_multiset( sp - osp );    }    -  push_text( "constaint" ); +  push_static_text( "constaint" );    switch( o->constraint_type )    {    case SANE_CONSTRAINT_NONE: push_int( 0 ); break;    case SANE_CONSTRAINT_RANGE: -  ref_push_string( literal_type_string ); push_text( "range" ); -  push_text( "min" ); push_int( o->constraint.range->min ); -  push_text( "max" ); push_int( o->constraint.range->max ); -  push_text( "quant" ); push_int( o->constraint.range->quant ); +  ref_push_string( literal_type_string ); push_static_text( "range" ); +  push_static_text( "min" ); push_int( o->constraint.range->min ); +  push_static_text( "max" ); push_int( o->constraint.range->max ); +  push_static_text( "quant" ); push_int( o->constraint.range->quant );    f_aggregate_mapping( 8 );    break;    case SANE_CONSTRAINT_WORD_LIST:    ref_push_string( literal_type_string ); -  push_text( "list" ); -  push_text( "list" ); +  push_static_text( "list" ); +  push_static_text( "list" );    for( i = 0; i<o->constraint.word_list[0]; i++ )    if( o->type == SANE_TYPE_FIXED )    push_float( SANE_UNFIX(o->constraint.word_list[i+1]) );
190:    break;    case SANE_CONSTRAINT_STRING_LIST:    ref_push_string( literal_type_string ); -  push_text( "list" ); -  push_text( "list" ); +  push_static_text( "list" ); +  push_static_text( "list" );    for( i = 0; o->constraint.string_list[i]; i++ )    push_text( o->constraint.string_list[i] );    f_aggregate( i );
413:    SANE_Parameters p;    pop_n_elems( args );    sane_get_parameters( THIS->h, &p ); -  push_text( "format" ); push_int( p.format ); -  push_text( "last_frame" ); push_int( p.last_frame ); -  push_text( "lines" ); push_int( p.lines ); -  push_text( "depth" ); push_int( p.depth ); -  push_text( "pixels_per_line" ); push_int( p.pixels_per_line ); -  push_text( "bytes_per_line" ); push_int( p.bytes_per_line ); +  push_static_text( "format" ); push_int( p.format ); +  push_static_text( "last_frame" ); push_int( p.last_frame ); +  push_static_text( "lines" ); push_int( p.lines ); +  push_static_text( "depth" ); push_int( p.depth ); +  push_static_text( "pixels_per_line" ); push_int( p.pixels_per_line ); +  push_static_text( "bytes_per_line" ); push_int( p.bytes_per_line );    f_aggregate_mapping( 12 );   }   
481:   {    if( !image_program )    { -  push_text( "Image.Image" ); +  push_static_text( "Image.Image" );    APPLY_MASTER( "resolv", 1 );    image_program = program_from_svalue( sp - 1 );    sp--;/* Do not free image program.. */