Date: Tue, 9 Jul 2013 07:32:47 GMT From: mattbw@FreeBSD.org To: svn-soc-all@FreeBSD.org Subject: socsvn commit: r254455 - soc2013/mattbw/backend/query Message-ID: <201307090732.r697WlmP073613@socsvn.freebsd.org>
next in thread | raw e-mail | index | archive | help
Author: mattbw Date: Tue Jul 9 07:32:47 2013 New Revision: 254455 URL: http://svnweb.FreeBSD.org/socsvn/?view=rev&rev=254455 Log: use C11 anonymous unions Modified: soc2013/mattbw/backend/query/core.c soc2013/mattbw/backend/query/core.h soc2013/mattbw/backend/query/do.c soc2013/mattbw/backend/query/match.c Modified: soc2013/mattbw/backend/query/core.c ============================================================================== --- soc2013/mattbw/backend/query/core.c Tue Jul 9 07:29:25 2013 (r254454) +++ soc2013/mattbw/backend/query/core.c Tue Jul 9 07:32:47 2013 (r254455) @@ -122,7 +122,7 @@ "package not found"); else { if (q->t->type == QUERY_EMIT) - success = q->t->data.emit.f(pkg, match_id, q); + success = q->t->emit.f(pkg, match_id, q); else if (q->t->type == QUERY_JOB) success = emit_to_job(pkg, q); } @@ -248,7 +248,7 @@ * non-installed packages. */ if (q->t->type == QUERY_EMIT && - (q->t->data.emit.load_flags & PKG_LOAD_FILES)) { + (q->t->emit.load_flags & PKG_LOAD_FILES)) { ERR(q->backend, PK_ERROR_ENUM_CANNOT_GET_FILELIST, "cannot get files for remote package"); @@ -275,7 +275,7 @@ backend = query_backend(q); - if (pkg_jobs_new(&jobs, q->t->data.job.type, q->db) != EPKG_OK) { + if (pkg_jobs_new(&jobs, q->t->job.type, q->db) != EPKG_OK) { ERR(backend, PK_ERROR_ENUM_INTERNAL_ERROR, "could not init pkg_jobs"); @@ -293,7 +293,7 @@ "could not add to job"); goto cleanup; } - success = q->t->data.job.f(jobs, q); + success = q->t->job.f(jobs, q); cleanup: pkg_jobs_free(jobs); @@ -412,7 +412,7 @@ struct pkg *pkg; if (q->t->type == QUERY_EMIT) - load_flags = q->t->data.emit.load_flags; + load_flags = q->t->emit.load_flags; else load_flags = PKG_LOAD_BASIC; @@ -449,12 +449,12 @@ */ id_strv = g_malloc0_n(5, (gsize) sizeof(gchar *)); - id_strv[PK_PACKAGE_ID_NAME] = g_strdup(s->data.single); + id_strv[PK_PACKAGE_ID_NAME] = g_strdup(s->single); id_strv[PK_PACKAGE_ID_VERSION] = g_strdup(""); id_strv[PK_PACKAGE_ID_ARCH] = g_strdup(""); id_strv[PK_PACKAGE_ID_DATA] = g_strdup(""); } else if (s->type == QUERY_SINGLE_ID) { - id_strv = pk_package_id_split(s->data.single); + id_strv = pk_package_id_split(s->single); if (id_strv == NULL) ERR(backend, PK_ERROR_ENUM_PACKAGE_ID_INVALID, Modified: soc2013/mattbw/backend/query/core.h ============================================================================== --- soc2013/mattbw/backend/query/core.h Tue Jul 9 07:29:25 2013 (r254454) +++ soc2013/mattbw/backend/query/core.h Tue Jul 9 07:32:47 2013 (r254455) @@ -49,7 +49,7 @@ union { bool unused; gchar *single; - } data; + }; /* Information about this query's position in a set of subqueries. */ unsigned int position; @@ -68,7 +68,7 @@ pkg_jobs_t type; job_emit_ptr f; } job; - } data; + }; }; PkBackend *query_backend(struct query *q); Modified: soc2013/mattbw/backend/query/do.c ============================================================================== --- soc2013/mattbw/backend/query/do.c Tue Jul 9 07:29:25 2013 (r254454) +++ soc2013/mattbw/backend/query/do.c Tue Jul 9 07:32:47 2013 (r254455) @@ -86,11 +86,11 @@ for (new_s.position = 0; new_s.position < new_s.total && success; (new_s.position)++) { - new_s.data.single = package_ids[new_s.position]; + new_s.single = package_ids[new_s.position]; /* Treat non-PackageIDs as pkgng package names, if allowed */ if (s->type == QUERY_BACKEND_IDS || - pk_package_id_check(new_s.data.single) == TRUE) + pk_package_id_check(new_s.single) == TRUE) new_s.type = QUERY_SINGLE_ID; else new_s.type = QUERY_SINGLE_NAME; Modified: soc2013/mattbw/backend/query/match.c ============================================================================== --- soc2013/mattbw/backend/query/match.c Tue Jul 9 07:29:25 2013 (r254454) +++ soc2013/mattbw/backend/query/match.c Tue Jul 9 07:32:47 2013 (r254455) @@ -37,13 +37,13 @@ struct query_source s; struct query_target t; - s.data.unused = true; + s.unused = true; s.position = 0; s.total = 1; s.type = QUERY_BACKEND_IDS; - t.data.emit.f = emitter; - t.data.emit.load_flags = load_flags; + t.emit.f = emitter; + t.emit.load_flags = load_flags; t.type = QUERY_EMIT; return query_do(backend, &s, &t); @@ -61,13 +61,13 @@ struct query_source s; struct query_target t; - s.data.unused = true; + s.unused = true; s.position = 0; s.total = 1; s.type = QUERY_BACKEND_IDS; - t.data.job.f = emitter; - t.data.job.type = type; + t.job.f = emitter; + t.job.type = type; t.type = QUERY_JOB; return query_do(backend, &s, &t);
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201307090732.r697WlmP073613>