Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Simplify code to handle TDS 4.2 metadata

We don't need to optimize this code that much

Signed-off-by: Frediano Ziglio <freddy77@gmail.com>
  • Loading branch information...
commit 1b7a0aa778dc4fb1d4d113a07e61ad8d95d994aa 1 parent 3134923
freddy77 freddy77 authored
Showing with 5 additions and 9 deletions.
  1. +5 −9 src/tds/token.c
14 src/tds/token.c
View
@@ -987,7 +987,7 @@ tds_process_col_name(TDSSOCKET * tds)
{
int hdrsize;
int col, num_names = 0;
- struct namelist *head = NULL, *cur = NULL, *prev;
+ struct namelist *head = NULL, *cur = NULL;
TDSCOLUMN *curcol;
TDSRESULTINFO *info;
@@ -1012,11 +1012,9 @@ tds_process_col_name(TDSSOCKET * tds)
curcol = info->columns[col];
tds_strlcpy(curcol->column_name, cur->name, sizeof(curcol->column_name));
curcol->column_namelen = (TDS_SMALLINT)strlen(curcol->column_name);
- prev = cur;
cur = cur->next;
- free(prev->name);
- free(prev);
}
+ tds_free_namelist(head);
return TDS_SUCCESS;
}
@@ -2653,7 +2651,7 @@ tds_process_compute_names(TDSSOCKET * tds)
TDS_USMALLINT compute_id = 0;
TDSCOMPUTEINFO *info;
- struct namelist *head = NULL, *cur, *next;
+ struct namelist *head = NULL, *cur;
CHECK_TDS_EXTRA(tds);
@@ -2690,11 +2688,9 @@ tds_process_compute_names(TDSSOCKET * tds)
tds_strlcpy(curcol->column_name, cur->name, sizeof(curcol->column_name));
curcol->column_namelen = (TDS_SMALLINT)strlen(curcol->column_name);
- next = cur->next;
- free(cur->name);
- free(cur);
- cur = next;
+ cur = cur->next;
}
+ tds_free_namelist(head);
return TDS_SUCCESS;
}
Please sign in to comment.
Something went wrong with that request. Please try again.