src/z-dice.c
int dice_bind_expression(dice_t *dice, const char *name,
						 const expression_t *expression)
{
	int i;

	if (dice->expressions == NULL)
		return -1;

	for (i = 0; i < DICE_MAX_EXPRESSIONS; i++) {
		if (dice->expressions[i].name == NULL)
			continue;

		if (my_stricmp(name, dice->expressions[i].name) == 0) {
			dice->expressions[i].expression = expression_copy(expression);

			if (dice->expressions[i].expression == NULL)
				return -1;

			return i;
		}
	}

	/* Couldn't find variable name to bind to. */
	return -1;
}
/**
 * Bind an expression to a variable name.
 *
 * This function creates a deep copy of the expression that the dice object owns
 *
 * \param dice is the object that will use the expression..
 * \param name is the variable that the expression should be bound to.
 * \param expression is the expression to bind.
 * \return The index of the expression or -1 for error.
 */
Bind an expression to a variable name.
This function creates a deep copy of the expression that the dice object owns

\param dice is the object that will use the expression
\param name is the variable that the expression should be bound to.
\param expression is the expression to bind.
\return The index of the expression or -1 for error.
Bind an expression to a variable name . This function creates a deep copy of the expression that the dice object owns \ param dice is the object that will use the expression \ param name is the variable that the expression should be bound to . \ param expression is the expression to bind . \ return The index of the expression or - 1 for error .
int dice_bind_expression(dice_t *dice, const char *name,
						 const expression_t *expression)
{
	int i;
	if (dice->expressions == NULL)
		return -1;
	for (i = 0; i < DICE_MAX_EXPRESSIONS; i++) {
		if (dice->expressions[i].name == NULL)
			continue;
		if (my_stricmp(name, dice->expressions[i].name) == 0) {
			dice->expressions[i].expression = expression_copy(expression);
			if (dice->expressions[i].expression == NULL)
				return -1;
			return i;
		}
	}
	return -1;
}
int dice_bind_expression ( dice_t * dice , const char * name , const expression_t * expression ) { int i ; if ( dice -> expressions == NULL ) return -1 ; for ( i = 0 ; i < DICE_MAX_EXPRESSIONS ; i ++ ) { if ( dice -> expressions [ i ] . name == NULL ) continue ; if ( my_stricmp ( name , dice -> expressions [ i ] . name ) == 0 ) { dice -> expressions [ i ] . expression = expression_copy ( expression ) ; if ( dice -> expressions [ i ] . expression == NULL ) return -1 ; return i ; } } return -1 ; }
Bind an expression to a variable name.
Bind an expression to a variable name .
/* Couldn't find variable name to bind to. */