ToolTalk User's Guide

Example of Marking and Releasing Information

Example 13–1 calls tt_mark() at the beginning of a routine that examines the information in a message. When the information examined in the routine is no longer needed and the message has been destroyed, tt_release() is called with the mark to free storage on the stack.


Example 13–1 Getting a Storage Mark

	/*
	 * Get a storage mark so we can easily free all the data
	 * ToolTalk returns to us.
	 */

	mark = tt_mark();

	if (0==strcmp(“ttsample1_value”, tt_message_op(msg_in))) {
			tt_message_arg_ival(msg_in, 0, &val_in);
			xv_set(gauge, PANEL_VALUE, val_in, NULL);
	}

	tt_message_destroy(msg_in);
	tt_release(mark);
	return;