MCPcopy Create free account
hub / github.com/AutoHotkey/AutoHotkey / GetExpandedArgSize

Method GetExpandedArgSize

source/script_expression.cpp:2307–2331  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

2305
2306
2307VarSizeType Line::GetExpandedArgSize()
2308// Returns the size, or VARSIZE_ERROR if there was a problem.
2309// This function can return a size larger than what winds up actually being needed
2310// (e.g. caused by ScriptGetCursor()), so our callers should be aware that that can happen.
2311{
2312 int i;
2313 VarSizeType space_needed;
2314
2315 // Note: the below loop is similar to the one in ExpandArgs(), so the two should be maintained together:
2316 for (i = 0, space_needed = 0; i < mArgc; ++i) // FOR EACH ARG:
2317 {
2318 ArgStruct &this_arg = mArg[i]; // For performance and convenience.
2319
2320 if (this_arg.is_expression)
2321 {
2322 // The length used below is more room than is strictly necessary, but given how little
2323 // space is typically wasted (and that only while the expression is being evaluated),
2324 // it doesn't seem worth worrying about it. See other comments at macro definition.
2325 space_needed += EXPR_BUF_SIZE(this_arg.length);
2326 }
2327 // Since is_expression is false, it must be plain text or a non-dynamic input/output var.
2328 }
2329
2330 return space_needed;
2331}
2332
2333

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected