Re: question on some code. - Mailing list pgsql-hackers

From Korry
Subject Re: question on some code.
Date
Msg-id 1121795665.4163.27.camel@sakai
Whole thread Raw
In response to question on some code.  (Chris Bowlby <excalibur@accesswave.ca>)
Responses Re: question on some code.  (Chris Bowlby <excalibur@accesswave.ca>)
List pgsql-hackers
<blockquote type="CITE"><pre>
<font color="#000000">If I understand the code right, your trying to pass in to </font>
<font color="#000000">appendBinaryStringInfo an "address" or reference to the n8, n16, or n32 </font>
<font color="#000000">variables and cast them so that a char * pointer can access that address </font>
<font color="#000000">space. Through some testing that I've been doing (outputting the values in </font>
<font color="#000000">the appendBinaryStringInfo function), I never seem to see any data, The </font>
<font color="#000000">variable pointer that references the "n8, n16, or n32" value is not holding </font>
<font color="#000000">any data in the appendBinaryStringInfo function.</font>
</pre></blockquote><br /> How are you looking at the data?  If you're treating the pointer as if it were a
null-terminatedstring, it's likely that the first byte is a null character much of the time.  Since this is binary data
(notcharacter data), you'll need to look at the individual bytes.  If you're using gdb, use 'x' command instead of the
'p'command.  If you've thrown a printf() into the code, you can't use a "%s" format specifier, you'll have to look at
thebytes one at a time using something like "%02X".<br /><br /><br />         -- Korry  

pgsql-hackers by date:

Previous
From: Chris Bowlby
Date:
Subject: question on some code.
Next
From: Peter Eisentraut
Date:
Subject: Re: config.sub/config.guess.