Commit 929a7598 authored by Dan Hipschman's avatar Dan Hipschman Committed by Alexandre Julliard

widl: Add an is_ptr function.

parent aadc90b2
......@@ -91,7 +91,7 @@ static void check_pointers(const func_t *func)
while (NEXT_LINK(var)) var = NEXT_LINK(var);
while (var)
{
if (is_pointer(var) && cant_be_null(var))
if (is_var_ptr(var) && cant_be_null(var))
{
print_client("if (!%s)\n", var->name);
print_client("{\n");
......
......@@ -1342,7 +1342,7 @@ static type_t *reg_typedefs(type_t *type, var_t *names, attr_t *attrs)
}
cur = alias(cur, names->name);
cur->attrs = attrs;
if (cur->ref)
if (is_ptr(cur))
cur->type = get_pointer_type(cur);
reg_type(cur, cur->name, 0);
}
......
......@@ -128,23 +128,9 @@ static void clear_output_vars( var_t *arg )
}
}
int is_pointer(var_t *arg)
int is_var_ptr(var_t *v)
{
if (arg->ptr_level)
return 1;
switch (ref_type(arg->type))
{
case RPC_FC_RP:
case RPC_FC_C_CSTRING:
case RPC_FC_C_WSTRING:
case RPC_FC_FP:
case RPC_FC_OP:
case RPC_FC_UP:
return 1;
}
return 0;
return v->ptr_level || is_ptr(v->type);
}
int cant_be_null(var_t *v)
......@@ -213,7 +199,7 @@ static void proxy_check_pointers( var_t *arg )
{
END_OF_LIST(arg);
while (arg) {
if (is_pointer(arg) && cant_be_null(arg)) {
if (is_var_ptr(arg) && cant_be_null(arg)) {
print_proxy( "if(!%s)\n", arg->name );
indent++;
print_proxy( "RpcRaiseException(RPC_X_NULL_REF_POINTER);\n");
......
......@@ -73,6 +73,17 @@ type_t *alias(type_t *t, const char *name)
return a;
}
int is_ptr(type_t *t)
{
unsigned char c = t->type;
return c == RPC_FC_RP
|| c == RPC_FC_UP
|| c == RPC_FC_FP
|| c == RPC_FC_OP
|| c == RPC_FC_C_CSTRING
|| c == RPC_FC_C_WSTRING;
}
/* List of oleauto types that should be recognized by name.
* (most of) these seem to be intrinsic types in mktyplib. */
......
......@@ -297,7 +297,8 @@ type_t *alias(type_t *t, const char *name);
/* Get the actual type field for a type (chase down typedef references). */
unsigned char ref_type(const type_t *type);
int is_pointer(var_t *v);
int is_ptr(type_t *t);
int is_var_ptr(var_t *v);
int cant_be_null(var_t *v);
#endif
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment