Skip to content

Commit

Permalink
Merge pull request #3 from mamins1376/master
Browse files Browse the repository at this point in the history
fix c89 for loops
  • Loading branch information
gozfree committed Aug 22, 2016
2 parents ad90414 + 9fd5e48 commit 711da27
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 3 deletions.
3 changes: 2 additions & 1 deletion libdebug/libdebug.c
Original file line number Diff line number Diff line change
Expand Up @@ -114,11 +114,12 @@ static void backtrace_handler(int sig_num, siginfo_t *info, void *ucontext)

int debug_backtrace_init(void)
{
uint32_t i;
struct sigaction sigact;
sigact.sa_sigaction = backtrace_handler;
sigact.sa_flags = SA_RESTART | SA_SIGINFO;
int ret = 0;
for (uint32_t i = 0; i < (sizeof(signum) / sizeof(uint32_t)); ++i) {
for (i = 0; i < (sizeof(signum) / sizeof(uint32_t)); ++i) {
if (sigaction(signum[i], &sigact, NULL) != 0) {
fprintf(stderr, "Failed to set signal handler for %s(%d)!",
strsignal(signum[i]),
Expand Down
6 changes: 4 additions & 2 deletions liblock/test_liblock.c
Original file line number Diff line number Diff line change
Expand Up @@ -40,9 +40,10 @@ static void *print_mutex_lock(void *arg)
struct thread_arg *argp = (struct thread_arg *)arg;
int c = argp->flag;
uint64_t n = argp->count;
uint64_t i;
pthread_t tid = pthread_self();
printf("c = %d\n", c);
for (uint64_t i = 0; i < n; ++ i) {
for (i = 0; i < n; ++ i) {
if (c) {
mutex_lock(mutex);
++ value;
Expand All @@ -66,10 +67,11 @@ static void *print_spin_lock(void *arg)
struct thread_arg *argp = (struct thread_arg *)arg;
int c = argp->flag;
uint64_t n = argp->count;
uint64_t i;
pthread_t tid = pthread_self();

printf("c = %d\n", c);
for (uint64_t i = 0; i < n; ++ i) {
for (i = 0; i < n; ++ i) {
if (c) {
spin_lock(spin);
++ value;
Expand Down

0 comments on commit 711da27

Please sign in to comment.