/*--------------------------------------------------------------------*/ /* stackaochecker.c */ /* Author: Christopher Moretti */ /*--------------------------------------------------------------------*/ #include "stackaochecker.h" #include int isValid(double *pdArray, size_t uTop, size_t uPhysLength, int iInitialized) { if(!iInitialized && (pdArray != NULL || uTop != 0 || uPhysLength != 0)) { fprintf(stderr, "Not initialized, but state is not NULL/0\n"); return 0; } if(iInitialized && (pdArray == NULL || uPhysLength == 0)) { fprintf(stderr, "Initialized, but storage array is not ready\n"); return 0; } if(uTop > uPhysLength) { fprintf(stderr, "Next push would be OOB of storage array\n"); return 0; } return 1; }