> > > typedef struct _agp_allocate {
> > > size_t pg_count; /* number of pages */
> > > [Is this really "number of pages", or is it actually
> > > "amount of memory"? If really "number of pages",
> > > then WHY ISNT IT AN INT?!!]
> >
> >
> > From what is in the code, AFAI understand, this *is*
> really the number
> > of pages. And 'size_t' is nothing but an 'unsigned int' ...
>
> Whether it really is an int underneath, is not the point.
> "size_t" should be used for "sizes".
> Mostly for BYTE counts of buffers.
> eg: read(char *,size_t)
> write(char *,size_t)
> bcopy (const void *, void *, size_t)
>
> "number of pages" is not a "size". It's a count. Hence it should be
> declared as a plain int. Similarly with the other ones in agpgart.
> Declaring it as size_t makes it seem like it is the bytecount
> of all the
> pages, rather than a number of pages.
possibly i am thinking a bit more practical:
- the number of pages should never go negative, so why do we need the sign?
- there is no reason why the number of pages should get limited to i.e.
2 GB instead of 4 GB on 32 bit machines.
- you are right in trying to distinguish number_of_bytes and
number_of_elements
by meance of different type defines for them.
- i am not aware of a better type define - you might want to suggest a new
one.
Suggestion:
typedef unsigned int elcount_t;
or
#define elcount_t unsigned int
But to proove you the opposite:
void *calloc(size_t nmemb, size_t size);
nmemb => number_of_elements
size => number_of_bytes (per element of course)
so the usage is already a bit puzzled for other central areas.
don't blame the agpgart programmers for introducing this...
_______________________________________________
Dri-devel mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/dri-devel