TMS340~O
Run-Time
Support
6.1
Memory
Management
Five routines
are
provided
to
implement C dynamic memory management.
These routines
are:
malloe
Allocates
an
area
of
a specified size in memory.
ealloe
Allocates and clears
an
area
of
memory.
realloe
Re-allocates a previously allocated memory
area
with
a
new
size.
free
De-allocates space allocated by cal/oc, mal/oc,
or
real/oc.
movmem
Moves a specified number
of
bytes from one address
to
another.
6.1.1
Specifying
the
Size
of
Memory
to
Manage
The amount
of
memory managed by the memory management routines
is
specified by the macro
memory-size
in
the
RTS
(run-time
support) module
memory.c,
which
contains the source code
for
all
the
memory management
routines. By modifying this value and recompiling the module, the amount
of
memory used can be changed.
6.2
String
Functions
6-2
Several functions
are
provided to
allow
manipulation
of
strings, search for
characters, and comparison
of
strings. These functions
are:
streat
*
strneat
*
strehr
strrehr
stremp
strnemp
strepv
*
strnepv
*
strlen
Appends a string
onto
the end
of
another string.
Appends a string
of
up
to
n characters
onto
another string.
Searches
for
the first occurrence
of
a character in a string.
Searches
for
the last occurrence
of
a character in a string.
Compares
two
strings.
Compares
up
to
n characters in
two
strings.
Copies a string
to
a
new
location.
Copies up
to
n characters
of
a string
to
a
new
location.
Returns the length
of
a string.
• When using functions that move or copy strings, ensure
that
the destination
is
large enough
to
contain the result.