File Index
Files and directories
Sign in
FILE

variable_length_array.j2

File preview with syntax highlighting.

linux-6.19.14/tools/net/sunrpc/xdrgen/templates/C/pointer/encoder/variable_length_array.j2 PLAIN TEXT
 1{# SPDX-License-Identifier: GPL-2.0 #}
 2{% if annotate %}
 3	/* member {{ name }} (variable-length array) */
 4{% endif %}
 5{% if maxsize != "0" %}
 6	if (value->{{ name }}.count > {{ maxsize }})
 7		return false;
 8{% endif %}
 9	if (xdr_stream_encode_u32(xdr, value->{{ name }}.count) != XDR_UNIT)
10		return false;
11	for (u32 i = 0; i < value->{{ name }}.count; i++)
12{% if type in pass_by_reference %}
13		if (!xdrgen_encode_{{ type }}(xdr, &value->{{ name }}.element[i]))
14{% else %}
15		if (!xdrgen_encode_{{ type }}(xdr, value->{{ name }}.element[i]))
16{% endif %}
17			return false;
~/ Read-only file preview.