Declared table `table` (1-based) of the block, or the number of declared * tables in *count when table is 0. */
| 1987 | /* Declared table `table` (1-based) of the block, or the number of declared |
| 1988 | * tables in *count when table is 0. */ |
| 1989 | static int toml_declared_table(const toml_managed_span_t *span, size_t table, size_t *count, |
| 1990 | toml_section_t *out) { |
| 1991 | size_t pos = span->owned_first; |
| 1992 | size_t index = 0U; |
| 1993 | while (pos < span->owned_len) { |
| 1994 | toml_section_t declared; |
| 1995 | if (++index > TOML_MANAGED_MAX_TABLES || |
| 1996 | toml_section_at(span->owned, pos, span->owned_len, &declared) != TOML_EDIT_OK) { |
| 1997 | return TOML_EDIT_ERR; |
| 1998 | } |
| 1999 | if (index == table) { |
| 2000 | *out = declared; |
| 2001 | return TOML_EDIT_OK; |
| 2002 | } |
| 2003 | pos = declared.end; |
| 2004 | toml_header_dispose(&declared.header); |
| 2005 | } |
| 2006 | if (count) { |
| 2007 | *count = index; |
| 2008 | } |
| 2009 | return table == 0U ? TOML_EDIT_OK : TOML_EDIT_ERR; |
| 2010 | } |
| 2011 | |
| 2012 | /* Classify one span header. seen[] marks the declared tables the span has |
| 2013 | * already supplied, so a second copy is refused instead of guessed at. */ |
no test coverage detected