From c7dfa5cd137057110eceec1227cb24c9002791f2 Mon Sep 17 00:00:00 2001 From: coshcage <58808125+coshcage@users.noreply.github.com> Date: Sat, 17 Feb 2024 23:49:08 +0000 Subject: [PATCH] Add files via upload --- src/sicore.c | 77 ++++++++++++++++++++++++---------------------------- 1 file changed, 36 insertions(+), 41 deletions(-) diff --git a/src/sicore.c b/src/sicore.c index 1232279..8afaf72 100644 --- a/src/sicore.c +++ b/src/sicore.c @@ -2,7 +2,7 @@ * Name: svimrdb.h * Description: SI core functions. * Author: cosh.cage#hotmail.com - * File ID: 0628231947B0130242056L00773 + * File ID: 0628231947B0217241548L00768 * License: GPLv2. */ #include /* Using macro BUFSIZ. */ @@ -293,55 +293,50 @@ P_MATRIX siCreateIntersectionView(P_MATRIX pmtxa, P_MATRIX pmtxb) return NULL; else { - if (pmtxa->col != pmtxb->col) - return NULL; - else - { - P_MATRIX mtxr = NULL; - size_t i; - P_MATRIX pma = siCreateUniqueView(pmtxa); - P_MATRIX pmb = siCreateUniqueView(pmtxb); - SET_T seta, setb, * psetc; - P_CELL * ptuple; - size_t a[2]; + P_MATRIX mtxr = NULL; + size_t i; + P_MATRIX pma = siCreateUniqueView(pmtxa); + P_MATRIX pmb = siCreateUniqueView(pmtxb); + SET_T seta, setb, * psetc; + P_CELL * ptuple; + size_t a[2]; - setInitT(&seta); - setInitT(&setb); + setInitT(&seta); + setInitT(&setb); - pthread_mutex_lock(&mtxSCT); + pthread_mutex_lock(&mtxSCT); - _sizCUTTarget = pma->col; + _sizCUTTarget = pma->col; - pthread_mutex_unlock(&mtxSCT); + pthread_mutex_unlock(&mtxSCT); - for (i = 0; i < pma->ln; ++i) - { - ptuple = strGetValueMatrix(NULL, pma, i, 0, sizeof(P_CELL)); - seta = treBSTInsertAA(seta, &ptuple, sizeof(P_CELL *), _sicbfcmp); - } + for (i = 0; i < pma->ln; ++i) + { + ptuple = strGetValueMatrix(NULL, pma, i, 0, sizeof(P_CELL)); + seta = treBSTInsertAA(seta, &ptuple, sizeof(P_CELL *), _sicbfcmp); + } - for (i = 0; i < pma->ln; ++i) - { - ptuple = strGetValueMatrix(NULL, pmb, i, 0, sizeof(P_CELL)); - setb = treBSTInsertAA(setb, &ptuple, sizeof(P_CELL *), _sicbfcmp); - } + for (i = 0; i < pma->ln; ++i) + { + ptuple = strGetValueMatrix(NULL, pmb, i, 0, sizeof(P_CELL)); + setb = treBSTInsertAA(setb, &ptuple, sizeof(P_CELL *), _sicbfcmp); + } - psetc = setCreateIntersectionT(&seta, &setb, sizeof(P_CELL), _sicbfcmp); - if (NULL != psetc) - { - mtxr = strCreateMatrix(setSizeT(psetc), pma->col, sizeof(P_CELL)); - a[0] = (size_t)mtxr; - a[1] = 0; - if (NULL != mtxr) - setTraverseT(psetc, _sicbftvsMergeView, (size_t)a, ETM_INORDER); - } + psetc = setCreateIntersectionT(&seta, &setb, sizeof(P_CELL), _sicbfcmp); + if (NULL != psetc) + { + mtxr = strCreateMatrix(setSizeT(psetc), pma->col, sizeof(P_CELL)); + a[0] = (size_t)mtxr; + a[1] = 0; + if (NULL != mtxr) + setTraverseT(psetc, _sicbftvsMergeView, (size_t)a, ETM_INORDER); + } - setFreeT(&seta); - setFreeT(&setb); - setDeleteT(psetc); + setFreeT(&seta); + setFreeT(&setb); + setDeleteT(psetc); - return mtxr; - } + return mtxr; } return NULL; }