[Date Prev][Date Next] [Chronological] [Thread] [Top]

Re: (ITS#4078) test001 fails on sparcv9



Actually, now that I've looked a bit closer - why use any buffer
size hack at all?

This is more readable and should work perfectly fine, as long as the
code consistently does not care if there is padding between the
Operation_info members:

typedef struct {
	Operation op;  /* oops, my previous union used *op */
	Opheader hdr;
	void *cids[SLAP_MAX_CIDS];
} Operation_info;

Then use
	Operation_info op_info;
	Operation *op = (Operation *) &op_info;
	...
	op->o_hdr = &op_info.hdr;
	-- or --
	op->o_hdr = &((Operation_info *)op)->hdr;
	...

Though LBER_ALIGNED_BUFFER(OPERATION_BUFFER_SIZE) may be the
quickest fix since it requires no inspection of code elsewhere.


(BTW, I set 'op' to '(Operation *) &op_info' rather than '&op_info.op'
since in the latter case the cast back to Operation_info* would not be
strictly correct ISO C.)

-- 
Hallvard