using off_t in talloc

tridge at tridge at
Sat Jul 22 01:34:27 GMT 2006


size_t is not guaranteed to be big enough to hold the sum of all
memory allocations in a program, and its also not guaranteed to be big
enough to hold the total count of memory allocations. It is only
guaranteed to be big enough to hold a single object. Back in the days
of DOS and small/large/huge memory models, it would have been quite
possible for size_t to be 16 bit, while off_t was 32 bit or even 64
bit. And you could certainly have a lot more memory allocated than
2^16 bytes.

I know this probably doesn't matter on any system that Samba currently
runs on, but talloc can potentially be used on other systems where we
can't guarantee that size_t is enough.

I also don't think this should be done by changing to size_t on some
systems and off_t on others. Having different prototypes on different
systems leads to problems.

The correct solution is to ensure we have off_t.

Cheers, Tridge

More information about the samba-technical mailing list