mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 1248534 (part 5) - Remove XPTDatapool. r=khuey.
It can just be inlined into XPTState, which simplifies things.
This commit is contained in:
parent
2324b7b000
commit
4a3a7d6c8f
@ -106,7 +106,7 @@ XPT_DoHeader(XPTArena *arena, XPTCursor *cursor, XPTHeader **headerp)
|
||||
* as our buffer unless it is zero (not set)
|
||||
*/
|
||||
if (header->file_length != 0 &&
|
||||
cursor->state->pool->allocated < header->file_length) {
|
||||
cursor->state->pool_allocated < header->file_length) {
|
||||
fputs("libxpt: File length in header does not match actual length. File may be corrupt\n",
|
||||
stderr);
|
||||
goto error;
|
||||
|
@ -21,7 +21,7 @@
|
||||
|
||||
/* can be used as lvalue */
|
||||
#define CURS_POINT(cursor) \
|
||||
((cursor)->state->pool->data[CURS_POOL_OFFSET(cursor)])
|
||||
((cursor)->state->pool_data[CURS_POOL_OFFSET(cursor)])
|
||||
|
||||
static PRBool
|
||||
CHECK_COUNT(XPTCursor* cursor, uint32_t space)
|
||||
@ -29,7 +29,7 @@ CHECK_COUNT(XPTCursor* cursor, uint32_t space)
|
||||
// Fail if we're in the data area and about to exceed the allocation.
|
||||
// XXX Also fail if we're in the data area and !state->data_offset
|
||||
if (cursor->pool == XPT_DATA &&
|
||||
(CURS_POOL_OFFSET(cursor) + space > (cursor)->state->pool->allocated)) {
|
||||
(CURS_POOL_OFFSET(cursor) + space > (cursor)->state->pool_allocated)) {
|
||||
XPT_ASSERT(0);
|
||||
fprintf(stderr, "FATAL: no room for %d in cursor\n", space);
|
||||
return PR_FALSE;
|
||||
@ -53,18 +53,12 @@ XPT_NewXDRState(char *data, uint32_t len)
|
||||
goto err_free_arena;
|
||||
|
||||
state->arena = arena;
|
||||
state->pool = XPT_NEW(arena, XPTDatapool);
|
||||
state->next_cursor[0] = state->next_cursor[1] = 1;
|
||||
if (!state->pool)
|
||||
goto err_free_state;
|
||||
|
||||
state->pool->data = data;
|
||||
state->pool->allocated = len;
|
||||
state->pool_data = data;
|
||||
state->pool_allocated = len;
|
||||
|
||||
return state;
|
||||
|
||||
err_free_state:
|
||||
XPT_DELETE(arena, state);
|
||||
err_free_arena:
|
||||
if (arena)
|
||||
XPT_DestroyArena(arena);
|
||||
@ -76,7 +70,6 @@ XPT_DestroyXDRState(XPTState *state)
|
||||
{
|
||||
XPTArena *arena = state->arena;
|
||||
|
||||
XPT_DELETE(arena, state->pool);
|
||||
XPT_DELETE(arena, state);
|
||||
if (arena)
|
||||
XPT_DestroyArena(arena);
|
||||
|
@ -17,7 +17,6 @@ extern "C" {
|
||||
#endif
|
||||
|
||||
typedef struct XPTState XPTState;
|
||||
typedef struct XPTDatapool XPTDatapool;
|
||||
typedef struct XPTCursor XPTCursor;
|
||||
|
||||
extern XPT_PUBLIC_API(PRBool)
|
||||
@ -51,13 +50,9 @@ typedef enum {
|
||||
struct XPTState {
|
||||
uint32_t data_offset;
|
||||
uint32_t next_cursor[2];
|
||||
XPTDatapool *pool;
|
||||
XPTArena *arena;
|
||||
};
|
||||
|
||||
struct XPTDatapool {
|
||||
char *data;
|
||||
uint32_t allocated;
|
||||
char *pool_data;
|
||||
uint32_t pool_allocated;
|
||||
};
|
||||
|
||||
struct XPTCursor {
|
||||
|
Loading…
Reference in New Issue
Block a user