<commit_before>// Copyright (c) 2015 Arista Networks, Inc.  All rights reserved.
// Arista Networks, Inc. Confidential and Proprietary.

#include <unistd.h>
#include <setjmp.h>
#include <signal.h>
#include <stdio.h>
#include <string.h>

sigjmp_buf jmpbuf;

/*
 * This handler will be invoked if there is an exception.
 * It needs to call longjmp to return to pre-exception
 * location: the location at which sigsetjmp was invoked
 * and provide the value that needs to be returned to the
 * call of sigjmp.
 */
void handler(int sig)
{
   // longjmp restores the environment saved by the most 
   // recent invocation of sigsetjmp() in the same thread
   longjmp(jmpbuf, 1);
}

float inverse(int x)
{
   // Note:
   // 1.0/x returns proper value for all values of x
   // For the case of 0, it returns infinity.
   // 1/x causes the exception if x is 0.
    return (1.0/x + 1/x);
}

int main(void)<commit_msg>Exception handling in C<commit_after>// Copyright (c) 2015 Arista Networks, Inc.  All rights reserved.
// Arista Networks, Inc. Confidential and Proprietary.

#include <unistd.h>
#include <setjmp.h>
#include <signal.h>
#include <stdio.h>
#include <string.h>

/*
 * Buffer to save the environment (exection context)
 * of the process
 */
sigjmp_buf jmpbuf;

/*
 * This handler will be invoked if there is an exception.
 * It needs to call longjmp to return to pre-exception
 * location: the location at which sigsetjmp was invoked
 * and provide the value that needs to be returned to the
 * call of sigjmp.
 */
void handler(int sig)
{
   // longjmp restores the environment saved by the most 
   // recent invocation of sigsetjmp() in the same thread
   longjmp(jmpbuf, 1);
}

float inverse(int x)
{
   // Note:
   // 1.0/x returns proper value for all values of x
   // For the case of 0, it returns infinity.
   // 1/x causes the exception if x is 0.
    return (1.0/x + 1/x);
}

int main(void)
{'fraction_non_alphanumeric': 0.09978991596638656, 'fraction_numerical': 0.01365546218487395, 'mean_word_length': 3.150326797385621, 'pattern_counts': {'":': 0, '<': 13, '<?xml version=': 0, '>': 13, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3205437', 'n_tokens_mistral': 651, 'n_tokens_neox': 617, 'n_words': 260}