---
name: "globus_rsl_free"
section: "3"
platform: "linux"
package: "libglobus-rsl-doc"
version: "11.4-2"
release: "Debian 13 (Trixie)"
platforms: ["linux"]
url: "https://new.carta.tech/globus_rsl_memory"
---

# globus\_rsl\_free(3)

RSL Memory Management - RSL Memory Management.

Part of [globus\_rsl\_memory(3)](/globus_rsl_memory/3.md).

## NAME

globus\_rsl\_memory - RSL Memory Management

 \- RSL Memory Management.

## SYNOPSIS

### Functions

globus\_rsl\_t \* **globus\_rsl\_copy\_recursive** (globus\_rsl\_t \*ast\_node)\
 Create a deep copy of an RSL syntax tree.  globus\_rsl\_value\_t \* **globus\_rsl\_value\_copy\_recursive** (globus\_rsl\_value\_t \*globus\_rsl\_value\_ptr)\
 Create a deep copy of an RSL value.  int **globus\_rsl\_value\_free** (globus\_rsl\_value\_t \*val)\
 Free an RSL value node.  int **globus\_rsl\_free** (globus\_rsl\_t \*ast\_node)\
 Free an RSL syntax tree node.  int **globus\_rsl\_value\_free\_recursive** (globus\_rsl\_value\_t \*globus\_rsl\_value\_ptr)\
 Free an RSL value and all its child nodes.  int **globus\_rsl\_free\_recursive** (globus\_rsl\_t \*ast\_node)\
 Free an RSL syntax tree and all its child nodes.  int **globus\_rsl\_value\_list\_literal\_replace** (globus\_list\_t \*value\_list, char \*string\_value)\
 Replace the first value in a value list with a literal.  int **globus\_rsl\_value\_eval** (globus\_rsl\_value\_t \*ast\_node, globus\_symboltable\_t \*symbol\_table, char \*\*string\_value, int rsl\_substitution\_flag)\
 Evaluate RSL substitions in an RSL value node.  int **globus\_rsl\_eval** (globus\_rsl\_t \*ast\_node, globus\_symboltable\_t \*symbol\_table)\
 Evaluate an RSL syntax tree.

## Detailed Description

RSL Memory Management.

## Function Documentation

### globus\_rsl\_t \* globus\_rsl\_copy\_recursive (globus\_rsl\_t \* ast\_node)

Create a deep copy of an RSL syntax tree. The **globus\_rsl\_copy\_recursive()** function performs a deep copy of the RSL syntax tree pointed to by the *ast\_node* parameter. All RSL nodes, value nodes, variable names, attributes, and literals will be copied to the return value.

**Parameters**

*ast\_node* An RSL syntax tree to copy.

**Returns**

The **globus\_rsl\_copy\_recursive()** function returns a copy of its input parameter that that can be used after the *ast\_node* and its values have been freed. If an error occurs, **globus\_rsl\_copy\_recursive()** returns NULL.

### int globus\_rsl\_eval (globus\_rsl\_t \* ast\_node, globus\_symboltable\_t \* symbol\_table)

Evaluate an RSL syntax tree. The **globus\_rsl\_eval()** function modifies the RSL parse tree pointed to by its *ast\_node* parameter by replacing all RSL substitution variable reference nodes with the literal values those variables evaluate to based on the current scope of the symbol table pointed to by the *symbol\_table* parameter. It also combines string concatenations into literal string values. Any nodes which are replaced by this function are freed using **globus\_rsl\_value\_free\_recursive()**.

**Parameters**

*ast\_node* A pointer to the RSL syntax tree to evaluate. \
 *symbol\_table* A symbol table containing current definitions of the RSL substitutions which can occur in this evaluation scope.

**Returns**

Upon success, **globus\_rsl\_eval()** returns *GLOBUS\_SUCCESS*, and replaces all RSL substitution values and concatenations in *ast\_node* or its child nodes with the evaluated forms described above. If an error occurs, **globus\_rsl\_eval()** returns a non-zero value.

### int globus\_rsl\_free (globus\_rsl\_t \* ast\_node)

Free an RSL syntax tree node. The **globus\_rsl\_free()** function frees the RSL syntax tree node pointed to by the *ast\_node* parameter. This only frees the RSL syntax tree node itself, and not any boolean operands, relation names, or values associated with the node.

**Parameters**

*ast\_node* The RSL syntax tree node to free.

**Returns**

The **globus\_rsl\_value\_free()** function always returns GLOBUS\_SUCCESS.

### int globus\_rsl\_free\_recursive (globus\_rsl\_t \* ast\_node)

Free an RSL syntax tree and all its child nodes. The **globus\_rsl\_free\_recursive()** function frees the RSL syntax tree pointed to by the *ast\_node* parameter, including all boolean operands, attribute names, and values. Any pointers to these are no longer valid after **globus\_rsl\_free\_recursive()** returns.

**Parameters**

*ast\_node* An RSL parse tree to free.

**Returns**

The **globus\_rsl\_value\_free\_recursive()** function always returns GLOBUS\_SUCCESS.

### globus\_rsl\_value\_t \* globus\_rsl\_value\_copy\_recursive (globus\_rsl\_value\_t \* globus\_rsl\_value\_ptr)

Create a deep copy of an RSL value. The **globus\_rsl\_value\_copy\_recursive()** function performs a deep copy of the RSL value pointed to by the *globus\_rsl\_value\_ptr* parameter. All variable names, attributes, literals, and value lists will be copied to the return value.

**Parameters**

*globus\_rsl\_value\_ptr* A pointer to an RSL value to copy.

**Returns**

The **globus\_rsl\_value\_copy\_recursive()** function returns a copy of its input parameter that that can be used after the *globus\_rsl\_value\_ptr* and its values have been freed. If an error occurs, **globus\_rsl\_value\_copy\_recursive()** returns NULL.

### int globus\_rsl\_value\_eval (globus\_rsl\_value\_t \* ast\_node, globus\_symboltable\_t \* symbol\_table, char \*\* string\_value, int rsl\_substitution\_flag)

Evaluate RSL substitions in an RSL value node. The **globus\_rsl\_value\_eval()** function modifies the value pointed to by its *ast\_node* parameter by replacing all RSL substitution variable reference nodes with the literal values those variables evaluate to based on the current scope of the symbol table pointed to by the *symbol\_table* parameter. It also combines string concatenations into literal string values. Any nodes which are replaced by this function are freed using **globus\_rsl\_value\_free\_recursive()**.

**Parameters**

*ast\_node* A pointer to the RSL value node to evaluate. \
 *symbol\_table* A symbol table containing current definitions of the RSL substitutions which can occur in this evaluation scope. \
 *string\_value* An output parameter which is set to point to the value of the string returned by evaluating the value node pointed to by *ast\_node* if it evaluates to a literal value. list pointed to by the *value\_list* parameter. \
 *rsl\_substitution\_flag* A flag indicating whether the node pointed to by the *ast\_node* parameter defines RSL substition variables.

**Returns**

Upon success, **globus\_rsl\_value\_eval()** returns *GLOBUS\_SUCCESS*, and replaces any RSL substitution values in the node pointed to by the *ast\_node* parameter. If the node evaluates to a single literal, the *string\_value* parameter is modified to point to the value of that literal. If an error occurs, **globus\_rsl\_value\_eval()** returns a non-zero value.

### int globus\_rsl\_value\_free (globus\_rsl\_value\_t \* val)

Free an RSL value node. The **globus\_rsl\_value\_free()** function frees the RSL value pointed to by the *val* parameter. This only frees the RSL value node itself, and not any sequence or string values associated with that node.

**Parameters**

*val* The RSL value node to free.

**Returns**

The **globus\_rsl\_value\_free()** function always returns GLOBUS\_SUCCESS.

### int globus\_rsl\_value\_free\_recursive (globus\_rsl\_value\_t \* globus\_rsl\_value\_ptr)

Free an RSL value and all its child nodes. The **globus\_rsl\_free\_recursive()** function frees the RSL value node pointed to by the *globus\_rsl\_value\_ptr*, including all literal strings, variable names, and value sequences. Any pointers to these are no longer valid after **globus\_rsl\_value\_free\_recursive()** returns.

**Parameters**

*globus\_rsl\_value\_ptr* An RSL value node to free.

**Returns**

The **globus\_rsl\_value\_free\_recursive()** function always returns GLOBUS\_SUCCESS.

### int globus\_rsl\_value\_list\_literal\_replace (globus\_list\_t \* value\_list, char \* string\_value)

Replace the first value in a value list with a literal. The **globus\_rsl\_value\_list\_literal\_replace()** function replaces the first value in the list pointed to by the *value\_list* parameter with a new value node that is a literal string node pointing to the value of the *string\_value* parameter, freeing the old value.

**Parameters**

*value\_list* The RSL value list to modify by replacing its first element. \
 *string\_value* The new string value to use as a literal first element of the list pointed to by the *value\_list* parameter.

**Returns**

Upon success, **globus\_rsl\_value\_list\_literal\_replace()** returns *GLOBUS\_SUCCESS*, frees the current first value of *value\_list* and replaces it with a new literal string node pointing to the value of the *string\_value* parameter. If an error occurs, **globus\_rsl\_value\_list\_literal\_replace()** returns 1.

## Author

Generated automatically by Doxygen for globus\_rsl from the source code.
