It's not a C interpeter, it's literally a frint end of sorts to grep. There's only one textual occurence of malloc() in the code, so it only returns one.
Think before you speak.
P.S. I'll add a C interpeter when there becomes a need for one.
Joris Huizer wrote:
Segin wrote:
As my small contribution, attached is a small shell script that, unmodified, finds out how many times certain functions are called in a given sample of files. The default functions are 'malloc', 'realloc', and 'free', and the sample files are all files ending in .c in the current directory. It even prints out the result in a neat manner on ANSI colourized terminals.
The script is very flexible, and easy to modify.
Current version is 256bytes long.
Hmmm, I'm affraid this isn't telling much, consider:
int main() { int i; char *ptr; for (i = 0; i < 10; i++) ptr = malloc(20); free(ptr); return 0; }
you're script will report one 'malloc' and one 'free', but ten times a 'malloc' is executed and only one 'free' ... :-/