Skip to content

Commit

Permalink
Make the initialization calls return argc.
Browse files Browse the repository at this point in the history
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@11261 91177308-0d34-0410-b5e6-96231b3b80d8
  • Loading branch information
lattner committed Feb 10, 2004
1 parent c6f7591 commit affce4f
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 9 deletions.
7 changes: 4 additions & 3 deletions runtime/libprofile/BlockProfiling.c
Original file line number Diff line number Diff line change
Expand Up @@ -34,10 +34,11 @@ static void BlockProfAtExitHandler() {
/* llvm_start_block_profiling - This is the main entry point of the block
* profiling library. It is responsible for setting up the atexit handler.
*/
void llvm_start_block_profiling(int argc, const char **argv,
unsigned *arrayStart, unsigned numElements) {
save_arguments(argc, argv);
int llvm_start_block_profiling(int argc, const char **argv,
unsigned *arrayStart, unsigned numElements) {
int Ret = save_arguments(argc, argv);
ArrayStart = arrayStart;
NumElements = numElements;
atexit(BlockProfAtExitHandler);
return Ret;
}
6 changes: 4 additions & 2 deletions runtime/libprofile/CommonProfiling.c
Original file line number Diff line number Diff line change
Expand Up @@ -27,9 +27,9 @@ static unsigned SavedArgsLength = 0;
/* save_arguments - Save argc and argv as passed into the program for the file
* we output.
*/
void save_arguments(int argc, const char **argv) {
int save_arguments(int argc, const char **argv) {
unsigned Length, i;
if (SavedArgs || !argv) return; /* This can be called multiple times */
if (SavedArgs || !argv) return argc; /* This can be called multiple times */

for (Length = 0, i = 0; i != (unsigned)argc; ++i)
Length += strlen(argv[i])+1;
Expand All @@ -43,6 +43,8 @@ void save_arguments(int argc, const char **argv) {
}

SavedArgsLength = Length;

return argc;
}


Expand Down
7 changes: 4 additions & 3 deletions runtime/libprofile/FunctionProfiling.c
Original file line number Diff line number Diff line change
Expand Up @@ -32,10 +32,11 @@ static void FuncProfAtExitHandler() {
/* llvm_start_func_profiling - This is the main entry point of the function
* profiling library. It is responsible for setting up the atexit handler.
*/
void llvm_start_func_profiling(int argc, const char **argv,
unsigned *arrayStart, unsigned numElements) {
save_arguments(argc, argv);
int llvm_start_func_profiling(int argc, const char **argv,
unsigned *arrayStart, unsigned numElements) {
int Ret = save_arguments(argc, argv);
ArrayStart = arrayStart;
NumElements = numElements;
atexit(FuncProfAtExitHandler);
return Ret;
}
2 changes: 1 addition & 1 deletion runtime/libprofile/Profiling.h
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
/* save_arguments - Save argc and argv as passed into the program for the file
* we output.
*/
void save_arguments(int argc, const char **argv);
int save_arguments(int argc, const char **argv);

enum ProfilingType {
Arguments = 1, /* The command line argument block */
Expand Down

0 comments on commit affce4f

Please sign in to comment.