* This routine supplies a pointer to a SparseData derived from an SvecType. * The SvecType is a serialized structure with fixed memory allocations, so * care must be taken not to append to the embedded StringInfo structs * without re-serializing the SparseData into the SvecType. */
| 80 | * without re-serializing the SparseData into the SvecType. |
| 81 | */ |
| 82 | static inline SparseData sdata_from_svec(SvecType *svec) |
| 83 | { |
| 84 | char *sdataptr = SVEC_SDATAPTR(svec); |
| 85 | SparseData sdata = (SparseData)sdataptr; |
| 86 | sdata->vals = (StringInfo)SDATA_DATA_SINFO(sdataptr); |
| 87 | sdata->index = (StringInfo)SDATA_INDEX_SINFO(sdataptr); |
| 88 | sdata->vals->data = SVEC_VALS_PTR(svec); |
| 89 | if (sdata->index->maxlen == 0) |
| 90 | { |
| 91 | sdata->index->data = NULL; |
| 92 | } else |
| 93 | { |
| 94 | sdata->index->data = SVEC_INDEX_PTR(svec); |
| 95 | } |
| 96 | return(sdata); |
| 97 | } |
| 98 | |
| 99 | char *svec_out_internal(SvecType *svec); |
| 100 | SvecType *svec_from_sparsedata(SparseData sdata,bool trim); |
no outgoing calls
no test coverage detected