9fans - fans of the OS Plan 9 from Bell Labs
 help / color / mirror / Atom feed
* Re: [9fans] libndb
@ 2004-03-07  2:20 David Presotto
  0 siblings, 0 replies; 6+ messages in thread
From: David Presotto @ 2004-03-07  2:20 UTC (permalink / raw)
  To: 9fans

>| These do the same thing csgetval, ndbgetval and ndbloolval but take a
>| length for the buffer that gets filled.
>
>How do they signal that it wasn't big enough?

I put out new versions that set the errstr to "return value truncated"
if it is.


^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [9fans] libndb
  2004-03-07 16:12     ` bs
@ 2004-03-07 16:17       ` David Presotto
  0 siblings, 0 replies; 6+ messages in thread
From: David Presotto @ 2004-03-07 16:17 UTC (permalink / raw)
  To: 9fans

[-- Attachment #1: Type: text/plain, Size: 293 bytes --]

I have a better idea.  Why don't I make the interface

	csgetvalue(char *netroot, char *attr, char *val, char *rattr, char **pp);

If buf is non-zero, I strdup a reply and sick a pointer to it in pp.
Given how much these routines to, it probably doesn't hurt to do the
extra malloc/free.

[-- Attachment #2: Type: message/rfc822, Size: 2559 bytes --]

From: bs <bs@nospam.com>
To: 9fans@cse.psu.edu
Subject: Re: [9fans] libndb
Date: Sun, 07 Mar 2004 11:12:36 -0500
Message-ID: <404B49F4.1070107@nospam.com>

Can i pass null for the buffer and a pointer to the length, and get the
length needed to be allocated?
> No, it just truncates.  Suggest something else if you like.  It's easy enough to
> call werrstr in it.
> 
> | These do the same thing csgetval, ndbgetval and ndbloolval but take a
> | length for the buffer that gets filled.
> 
> How do they signal that it wasn't big enough?


^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [9fans] libndb
  2004-03-07  1:50   ` David Presotto
@ 2004-03-07 16:12     ` bs
  2004-03-07 16:17       ` David Presotto
  0 siblings, 1 reply; 6+ messages in thread
From: bs @ 2004-03-07 16:12 UTC (permalink / raw)
  To: 9fans

Can i pass null for the buffer and a pointer to the length, and get the
length needed to be allocated?
> No, it just truncates.  Suggest something else if you like.  It's easy enough to
> call werrstr in it.
> 
> | These do the same thing csgetval, ndbgetval and ndbloolval but take a
> | length for the buffer that gets filled.
> 
> How do they signal that it wasn't big enough?




^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [9fans] libndb
  2004-03-07  1:38 ` Scott Schwartz
@ 2004-03-07  1:50   ` David Presotto
  2004-03-07 16:12     ` bs
  0 siblings, 1 reply; 6+ messages in thread
From: David Presotto @ 2004-03-07  1:50 UTC (permalink / raw)
  To: 9fans

[-- Attachment #1: Type: text/plain, Size: 101 bytes --]

No, it just truncates.  Suggest something else if you like.  It's easy enough to
call werrstr in it.

[-- Attachment #2: Type: message/rfc822, Size: 2051 bytes --]

From: Scott Schwartz <schwartz@bio.cse.psu.edu>
To: 9fans@cse.psu.edu
Subject: Re: [9fans] libndb
Date: Sat, 06 Mar 2004 20:38:43 -0500
Message-ID: <20040307013844.3999.qmail@g.galapagos.bx.psu.edu>

| These do the same thing csgetval, ndbgetval and ndbloolval but take a
| length for the buffer that gets filled.

How do they signal that it wasn't big enough?

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [9fans] libndb
  2004-03-07  0:20 David Presotto
@ 2004-03-07  1:38 ` Scott Schwartz
  2004-03-07  1:50   ` David Presotto
  0 siblings, 1 reply; 6+ messages in thread
From: Scott Schwartz @ 2004-03-07  1:38 UTC (permalink / raw)
  To: 9fans

| These do the same thing csgetval, ndbgetval and ndbloolval but take a
| length for the buffer that gets filled.

How do they signal that it wasn't big enough?



^ permalink raw reply	[flat|nested] 6+ messages in thread

* [9fans] libndb
@ 2004-03-07  0:20 David Presotto
  2004-03-07  1:38 ` Scott Schwartz
  0 siblings, 1 reply; 6+ messages in thread
From: David Presotto @ 2004-03-07  0:20 UTC (permalink / raw)
  To: 9fans

Big changes.  The fixed length for the value of attr/value pairs was getting
to be a pain so I made it variable.  Shouldn't affect most things that use
it but to be on the safe side I created:

Ndbtuple*	csgetvalue(char*, char*, char*, char*, char*, int);
Ndbtuple*	ndbgetvalue(Ndb*, Ndbs*, char*, char*, char*, char*, int);
Ndbtuple*	ndblookvalue(Ndbtuple*, Ndbtuple*, char*, char*, int);

These do the same thing csgetval, ndbgetval and ndbloolval but take a
length for the buffer that gets filled.   The old interfaces will
eventually disappear.


^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2004-03-07 16:17 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2004-03-07  2:20 [9fans] libndb David Presotto
  -- strict thread matches above, loose matches on Subject: below --
2004-03-07  0:20 David Presotto
2004-03-07  1:38 ` Scott Schwartz
2004-03-07  1:50   ` David Presotto
2004-03-07 16:12     ` bs
2004-03-07 16:17       ` David Presotto

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).