# Ini_SortInternally

int Ini_SortInternally (IniText handle);

## Purpose

This function gives the same performance benefits as Ini_Sort, but it does not alter the order of the tag/value pairs in the list identified by handle.

When internal sorting is enabled by this function, an additional internal list of pointers to tag/value pairs is created, sorted, and used to speed up IniText operations. The original list is maintained as well so that the order of the tag/value pairs in the list is preserved when the IniText is written to a file or traversed using the Ini_NthItemName and Ini_NthSectionName functions.

If the Ini_Text has enabled regular sorting by calling Ini_Sort or by passing TRUE to Ini_New then enabling internal sorting with this function will not improve performance any further.

See the help for Ini_Sort.

Effect of Sorting on Performance

If sorting is enabled, the following performance characteristics hold:

- Getting values from the in-memory list is faster.
- If checking for duplicates is enabled (the default), adding values to the in-memory list is faster than it would be for a non-sorted list.
- If checking for duplicates is disabled, adding values to the in-memory list is slower than it would be for a non-sorted list. (See the Ini_SetDuplicateChecking function.)

## Parameters

Input
Name | Type | Description
handle | IniText | A handle returned from Ini_New. It represents the list of in-memory tag/value pairs.

## Return Value

Name | Type | Description
status | integer | Indicates whether the function was successful. A zero indicates success. A negative value indicates an error. If the value is from –1 to –999, it is one of the error values defined in userint.h. If the value is from –5000 to –5999, it is one of the error values defined in toolbox.h. The only error you are likely to encounter is: –12 Out of memory!