pspp-dev
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: data_out


From: John Darrington
Subject: Re: data_out
Date: Fri, 28 Apr 2006 12:53:07 +0800
User-agent: Mutt/1.5.9i

On Thu, Apr 27, 2006 at 09:32:52PM -0700, Ben Pfaff wrote:
     John Darrington <address@hidden> writes:
     
     > Any objections if  we change the signature of data_out, so that the
     > first argument is char ** or struct string * , and have the function
     > allocate the required amount of storage?
     >
     >
     > Right now, we never know how big a string needs to be passed to it.
     
     We don't?  The string has to be as wide as the field width, fp->w.


I stand corrected.  We do know, but it's non constant. It might be 1
on the first call and 10000 the next.

Perhaps I should explain my motives. I want to append the result to a struct 
string.  The only way I can currently do that is to violate the encapsulation 
of struct string.

     {
       struct string s;
       ds_init(&s);
       
       .
       .
       .
       x = ds_length(&s);

       /* Somehow make sure that s has sufficient length */

       data_out (ds_c_str(&s)+x, &v->print, case_data (c, v->fv));
     }                                    


J'

-- 
PGP Public key ID: 1024D/2DE827B3 
fingerprint = 8797 A26D 0854 2EAB 0285  A290 8A67 719C 2DE8 27B3
See http://pgp.mit.edu or any PGP keyserver for public key.


Attachment: signature.asc
Description: Digital signature


reply via email to

[Prev in Thread] Current Thread [Next in Thread]