IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Ignore:
Timestamp:
Feb 8, 2023, 12:17:35 PM (3 years ago)
Author:
eugene
Message:

merge from eam_branches/ipp-20220316. fixes for more pendantic gcc; add opihi memory stats; string vector improvements; use named macros for fixed string lengths

Location:
trunk/Ohana
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/Ohana

  • trunk/Ohana/src/opihi/lib.shell/stack_math.c

    r42311 r42389  
    17141714  char line[512]; // this is only used to report an error
    17151715  snprintf (line, 512, "error: op %s not defined as unary vector op!", op);
     1716  push_error (line);
     1717  return (FALSE);
     1718
     1719escape:
     1720
     1721  if (V1[0].type == ST_VECTOR_TMP) {
     1722    free (V1[0].vector[0].elements.Ptr);
     1723    free (V1[0].vector);
     1724    V1[0].vector = NULL;
     1725  } 
     1726
     1727  clear_stack (V1);
     1728  return (TRUE);
     1729
     1730}
     1731
     1732// vector string operations
     1733int L_unary (StackVar *OUT, StackVar *V1, char *op) {
     1734
     1735  int Nx = V1[0].vector[0].Nelements;
     1736
     1737  OUT[0].vector = InitVector ();
     1738  OUT[0].type = ST_VECTOR_TMP; /*** <<--- says this is a temporary matrix ***/
     1739
     1740  ResetVector (OUT[0].vector, OPIHI_STR, V1[0].vector[0].Nelements);
     1741  char **Iv =  V1[0].vector[0].elements.Str;
     1742  char **Ov = OUT[0].vector[0].elements.Str;
     1743  if (!strcmp (op, "=")) {
     1744    for (int i = 0; i < Nx; i++) {                     
     1745      Ov[i] = strcreate (Iv[i]);
     1746    }                                                                   
     1747    goto escape;                                                       
     1748  }
     1749
     1750  // free the temp vector if needed
     1751  if (V1[0].type == ST_VECTOR_TMP) {
     1752    // XXX this probably does not free the strings
     1753    free (V1[0].vector[0].elements.Ptr);
     1754    free (V1[0].vector);
     1755    V1[0].vector = NULL;
     1756  } 
     1757
     1758  clear_stack (V1);
     1759
     1760  char line[512]; // this is only used to report an error
     1761  snprintf (line, 512, "error: op %s not defined as unary string vector op!", op);
    17161762  push_error (line);
    17171763  return (FALSE);
Note: See TracChangeset for help on using the changeset viewer.