Bug 811203 (part 1) - Inline XPTMethodDescriptor::result. r=khuey.

--HG--
extra : rebase_source : 1c2a89684f5b60a3e24ce995ed7e062e88e18610
This commit is contained in:
Nicholas Nethercote 2012-11-19 16:18:41 -08:00
parent f54dc1694d
commit 2f67c810c2
4 changed files with 9 additions and 20 deletions

View File

@ -172,7 +172,7 @@ public:
return params[idx];
}
const nsXPTParamInfo GetResult() const
{return *result;}
{return result;}
private:
nsXPTMethodInfo(); // no implementation
// NO DATA - this a flyweight wrapper

View File

@ -449,7 +449,7 @@ XPT_FillParamDescriptor(XPTArena *arena,
struct XPTMethodDescriptor {
char *name;
XPTParamDescriptor *params;
XPTParamDescriptor *result;
XPTParamDescriptor result;
uint8_t flags;
uint8_t num_args;
};

View File

@ -392,7 +392,6 @@ XPT_FreeInterfaceDescriptor(XPTArena *arena, XPTInterfaceDescriptor* id)
for (; md < mdend; md++) {
XPT_FREEIF(arena, md->name);
XPT_FREEIF(arena, md->params);
XPT_FREEIF(arena, md->result);
}
XPT_FREEIF(arena, id->method_descriptors);
@ -514,10 +513,10 @@ SizeOfMethodDescriptor(XPTMethodDescriptor *md, XPTInterfaceDescriptor *id)
{
uint32_t i, size = 1 /* flags */ + 4 /* name */ + 1 /* num_args */;
for (i = 0; i < md->num_args; i++)
for (i = 0; i < md->num_args; i++)
size += 1 + SizeOfTypeDescriptor(&md->params[i].type, id);
size += 1 + SizeOfTypeDescriptor(&md->result->type, id);
size += 1 + SizeOfTypeDescriptor(&md->result.type, id);
return size;
}
@ -711,9 +710,6 @@ XPT_FillMethodDescriptor(XPTArena *arena, XPTMethodDescriptor *meth,
} else {
meth->params = NULL;
}
meth->result = XPT_NEWZAP(arena, XPTParamDescriptor);
if (!meth->result)
goto free_params;
return PR_TRUE;
free_params:
@ -746,14 +742,7 @@ DoMethodDescriptor(XPTArena *arena, XPTCursor *cursor, XPTMethodDescriptor *md,
goto error;
}
if (mode == XPT_DECODE) {
md->result = XPT_NEWZAP(arena, XPTParamDescriptor);
if (!md->result)
return PR_FALSE;
}
if (!md->result ||
!DoParamDescriptor(arena, cursor, md->result, id))
if (!DoParamDescriptor(arena, cursor, &md->result, id))
goto error;
return PR_TRUE;

View File

@ -88,16 +88,16 @@ main(int argc, char **argv)
meth = &id->method_descriptors[0];
ok = XPT_FillMethodDescriptor(arena, meth, 0, "method1", 0);
TRY("FillMethodDescriptor", ok);
meth->result->flags = 0;
meth->result->type.prefix.flags = TD_VOID;
meth->result.flags = 0;
meth->result.type.prefix.flags = TD_VOID;
/* wstring method2(in uint32_t, in bool) */
meth = &id->method_descriptors[1];
ok = XPT_FillMethodDescriptor(arena, meth, 0, "method2", 2);
TRY("FillMethodDescriptor", ok);
meth->result->flags = 0;
meth->result->type.prefix.flags = TD_PSTRING | XPT_TDP_POINTER;
meth->result.flags = 0;
meth->result.type.prefix.flags = TD_PSTRING | XPT_TDP_POINTER;
meth->params[0].type.prefix.flags = TD_UINT32;
meth->params[0].flags = XPT_PD_IN;
meth->params[1].type.prefix.flags = TD_BOOL;