<commit_before>#include <stdio.h>
#include <string.h>
#include <time.h>
#include <stdlib.h>

#include "coco.h"
#include "coco.c"

#include "mex.h"
#include "matrix.h"

/* The gateway function */
void mexFunction(int nlhs, mxArray *plhs[], int nrhs, const mxArray *prhs[])
{
    const char *problem_suit;   /* input string */
    int findex;                 /* input integer */
    
    coco_problem_t *pb = NULL;  /* intern variable */

    /* check for proper number of arguments */
    if(nrhs!=2) {
        mexErrMsgIdAndTxt("validProblem:nrhs","Two inputs required.");
    }
    if(nlhs!=1) {
        mexErrMsgIdAndTxt("validProblem:nlhs","One output required.");
    }
    /* make sure the first input argument is string */
    if(!mxIsChar(prhs[0])) {
        mexErrMsgIdAndTxt("validProblem:notString","Input problem_suit must be a string.");
    }
    /* make sure the second input argument is integer */
    if(!mxIsInt8(prhs[1]) && !mxIsInt16(prhs[1]) && !mxIsInt32(prhs[1]) && !mxIsInt64(prhs[1])) {
        mexErrMsgIdAndTxt("validProblem:notInteger","Input findex must be an integer.");
    }
    /* get the value of the string input */
    problem_suit = mxArrayToString(prhs[0]);
    if(problem_suit == NULL) 
      mexErrMsgIdAndTxt( "validProblem:conversionFailed", "Could not convert input to string.");
    /* get the value of the integer input */
    findex = mxGetScalar(prhs[1]);

    /* call the computational routine */
    pb = coco_get_problem(problem_suit, (mwSize)findex);
    plhs[0] = mxCreateLogicalScalar(pb != NULL);
}
<commit_msg>free memory in validProblem.c<commit_after>#include <stdio.h>
#include <string.h>
#include <time.h>
#include <stdlib.h>

#include "coco.h"
#include "coco.c"

#include "mex.h"
#include "matrix.h"

/* The gateway function */
void mexFunction(int nlhs, mxArray *plhs[], int nrhs, const mxArray *prhs[])
{
    const char *problem_suit;   /* input string */
    int findex;                 /* input integer */
    
    coco_problem_t *pb = NULL;  /* intern variable */

    /* check for proper number of arguments */
    if(nrhs!=2) {
        mexErrMsgIdAndTxt("validProblem:nrhs","Two inputs required.");
    }
    if(nlhs!=1) {
        mexErrMsgIdAndTxt("validProblem:nlhs","One output required.");
    }
    /* make sure the first input argument is string */
    if(!mxIsChar(prhs[0])) {
        mexErrMsgIdAndTxt("validProblem:notString","Input problem_suit must be a string.");
    }
    /* make sure the second input argument is integer */
    if(!mxIsInt8(prhs[1]) && !mxIsInt16(prhs[1]) && !mxIsInt32(prhs[1]) && !mxIsInt64(prhs[1])) {
        mexErrMsgIdAndTxt("validProblem:notInteger","Input findex must be an integer.");
    }
    /* get the value of the string input */
    problem_suit = mxArrayToString(prhs[0]);
    if(problem_suit == NULL) 
      mexErrMsgIdAndTxt( "validProblem:conversionFailed", "Could not convert input to string.");
    /* get the value of the integer input */
    findex = mxGetScalar(prhs[1]);

    /* call the computational routine */
    pb = coco_get_problem(problem_suit, (mwSize)findex);
    plhs[0] = mxCreateLogicalScalar(pb != NULL);
    coco_free_problem(pb);
}

{'fraction_non_alphanumeric': 0.14380321665089876, 'fraction_numerical': 0.010722169662567014, 'mean_word_length': 3.3812154696132595, 'pattern_counts': {'":': 0, '<': 11, '<?xml version=': 0, '>': 11, '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': '5600543', 'n_tokens_mistral': 1102, 'n_tokens_neox': 1075, 'n_words': 260}