pike.git / src / builtin.cmod

version» Context lines:

pike.git/src/builtin.cmod:2976:       PIKEFUN int _size_object()    {    RETURN THIS->str.malloced;    }       void f_Buffer_get_copy( INT32 args );    void f_Buffer_get( INT32 args );    void f_Buffer_add( INT32 args );    -  /*! @decl void create(int initial_size) +  /*! @decl void create(void|int(1..) initial_size)    *!    *! Initializes a new buffer.    *!    *! If no @[initial_size] is specified, 256 is used. If you    *! know approximately how big the buffer will be, you can optimize    *! the operation of @[add()] (slightly) by passing the size to this    *! function.    */    PIKEFUN void create( int|void size )    {    struct Buffer_struct *str = THIS;    init_string_builder_alloc(&str->str, -  str->initial = size ? MAXIMUM( size->u.integer, 512 ) : 256 , 0); +  str->initial = size ? MINIMUM(size->u.integer, 1 ) : 256 , 0);    }       /*! @decl string _sprintf( int flag, mapping flags )    *! It is possible to @[sprintf] a String.Buffer object    *! as @tt{%s@} just as if it was a string.    */    PIKEFUN string _sprintf( int flag, mapping flags )    {    switch( flag )    {