From owner-svn-soc-all@FreeBSD.ORG Tue Jul 9 07:32:48 2013 Return-Path: Delivered-To: svn-soc-all@FreeBSD.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by hub.freebsd.org (Postfix) with ESMTP id 1614AFCD for ; Tue, 9 Jul 2013 07:32:48 +0000 (UTC) (envelope-from mattbw@FreeBSD.org) Received: from socsvn.freebsd.org (socsvn.freebsd.org [IPv6:2001:1900:2254:206a::50:2]) by mx1.freebsd.org (Postfix) with ESMTP id 080261D90 for ; Tue, 9 Jul 2013 07:32:48 +0000 (UTC) Received: from socsvn.freebsd.org ([127.0.1.124]) by socsvn.freebsd.org (8.14.7/8.14.7) with ESMTP id r697Wlxd073618 for ; Tue, 9 Jul 2013 07:32:47 GMT (envelope-from mattbw@FreeBSD.org) Received: (from www@localhost) by socsvn.freebsd.org (8.14.7/8.14.6/Submit) id r697WlmP073613 for svn-soc-all@FreeBSD.org; Tue, 9 Jul 2013 07:32:47 GMT (envelope-from mattbw@FreeBSD.org) Date: Tue, 9 Jul 2013 07:32:47 GMT Message-Id: <201307090732.r697WlmP073613@socsvn.freebsd.org> X-Authentication-Warning: socsvn.freebsd.org: www set sender to mattbw@FreeBSD.org using -f From: mattbw@FreeBSD.org To: svn-soc-all@FreeBSD.org Subject: socsvn commit: r254455 - soc2013/mattbw/backend/query MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-soc-all@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the entire Summer of Code repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 09 Jul 2013 07:32:48 -0000 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);