Changeset 42157
- Timestamp:
- Apr 4, 2022, 3:59:33 PM (4 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/eam_branches/ipp-20220316/Ohana/src/opihi/cmd.data/subset.c
r35109 r42157 44 44 ResetVector (ovec, ivec->type, tvec[0].Nelements); 45 45 46 // we have four cases: (ivec == flt or int) and (tvec == flt or int)46 // we have size cases: (ivec == flt, int, str) and (tvec == flt or int) 47 47 if ((ivec->type == OPIHI_FLT) && (tvec->type == OPIHI_FLT)) { 48 48 opihi_flt *vi = ivec[0].elements.Flt; … … 81 81 } 82 82 } 83 // XXX if ivec is an existing vector, this step will 84 // leak (existing elements need to be freed if they 85 // have been allocated). 86 if ((ivec->type == OPIHI_STR) && (tvec->type == OPIHI_FLT)) { 87 opihi_flt *vt = tvec[0].elements.Flt; 88 for (Npts = i = 0; i < tvec[0].Nelements; i++, vt++) { 89 if (!*vt) continue; 90 ovec[0].elements.Str[Npts] = strcreate(ivec[0].elements.Str[i]); 91 Npts++; 92 } 93 } 94 if ((ivec->type == OPIHI_STR) && (tvec->type == OPIHI_INT)) { 95 opihi_int *vt = tvec[0].elements.Int; 96 for (Npts = i = 0; i < tvec[0].Nelements; i++, vt++) { 97 if (!*vt) continue; 98 ovec[0].elements.Str[Npts] = strcreate(ivec[0].elements.Str[i]); 99 Npts++; 100 } 101 } 83 102 84 103 // free up unused memory
Note:
See TracChangeset
for help on using the changeset viewer.
