icalgauge* icalgauge_new_from_sql(char* sql, int expand) { struct icalgauge_impl *impl; yyscan_t yy_globals = NULL; int r; if ( ( impl = (struct icalgauge_impl*) malloc(sizeof(struct icalgauge_impl))) == 0) { icalerror_set_errno(ICAL_NEWFAILED_ERROR); return 0; } impl->select = pvl_newlist(); impl->from = pvl_newlist(); impl->where = pvl_newlist(); impl->expand = expand; sslex_init(&yy_globals); ssset_extra(impl, yy_globals); ss_scan_string(sql, yy_globals); r = ssparse(yy_globals); sslex_destroy(yy_globals); if (r == 0) { return impl; } else { icalgauge_free(impl); return NULL; } }
icalgauge *icalgauge_new_from_sql(char *sql, int expand) { struct icalgauge_impl *impl; int r; if ((impl = (struct icalgauge_impl *)malloc(sizeof(struct icalgauge_impl))) == 0) { icalerror_set_errno(ICAL_NEWFAILED_ERROR); return 0; } impl->select = pvl_newlist(); impl->from = pvl_newlist(); impl->where = pvl_newlist(); impl->expand = expand; icalss_yy_gauge = impl; input_buffer = input_buffer_p = sql; r = ssparse(); if (r == 0) { return impl; } else { icalgauge_free(impl); return NULL; } }