* Makes an empty svec with sufficient memory allocated for the input number */
| 347 | * Makes an empty svec with sufficient memory allocated for the input number |
| 348 | */ |
| 349 | SvecType *makeEmptySvec(int allocation) |
| 350 | { |
| 351 | int val_len = sizeof(float8)*allocation+1; |
| 352 | int ind_len = 9*allocation+1; |
| 353 | SvecType *svec; |
| 354 | SparseData sdata = makeEmptySparseData(); |
| 355 | sdata->vals->data = (char *)palloc(val_len); |
| 356 | sdata->vals->len = 0; |
| 357 | sdata->vals->maxlen = val_len; |
| 358 | sdata->index->data = (char *)palloc(ind_len); |
| 359 | sdata->index->len = 0; |
| 360 | sdata->index->maxlen = ind_len; |
| 361 | svec = svec_from_sparsedata(sdata,false); |
| 362 | freeSparseDataAndData(sdata); |
| 363 | return(svec); |
| 364 | } |
| 365 | |
| 366 | /** |
| 367 | * Allocates more space for the count and data arrays of an svec |
no test coverage detected