Date: Sun, 5 Aug 2007 18:47:10 GMT From: Fredrik Lindberg <fli@FreeBSD.org> To: Perforce Change Reviews <perforce@FreeBSD.org> Subject: PERFORCE change 124746 for review Message-ID: <200708051847.l75IlAwp041530@repoman.freebsd.org>
next in thread | raw e-mail | index | archive | help
http://perforce.freebsd.org/chv.cgi?CH=124746 Change 124746 by fli@fli_nexus on 2007/08/05 18:47:07 Follow the changes done to the record database. Affected files ... .. //depot/projects/soc2007/fli-mdns_sd/mdnsd/parse.y#3 edit Differences ... ==== //depot/projects/soc2007/fli-mdns_sd/mdnsd/parse.y#3 (text+ko) ==== @@ -223,9 +223,8 @@ struct cfg_name *cn; struct cfg_res *cs; struct cfg_resdata *csd; - int i, ttl; - struct dbr_rec *dr; - wchar_t **names, *wp; + int ttl; + wchar_t *nam, *wp; size_t len; if (!cfg_ifvalid && cfg_ifpassed) @@ -241,21 +240,15 @@ cfg_rrset.cr_ident, (cfg_rrset.cr_shared ? " (shared)" : ""), cfg_rrset.cr_namcount); - /* Do not free names, its in use by dbr_add() */ - names = malloc(sizeof(wchar_t *) * (cfg_rrset.cr_namcount + 1)); - i = 0; + dbr_ident_add(dbr, cfg_rrset.cr_ident); TAILQ_FOREACH(cn, &cfg_rrset.cr_names, cn_next) { dprintf(DEBUG_CFGPARSE, " %s", cn->cn_name); len = strlen(cn->cn_name) + 1; - names[i] = malloc(len * sizeof(wchar_t)); - mbstowcs(names[i], cn->cn_name, len); - i++; + nam = malloc(len * sizeof(wchar_t)); + mbstowcs(nam, cn->cn_name, len); + dbr_name_add(dbr, cfg_rrset.cr_ident, nam); + free(nam); } - names[i] = NULL; - - dr = dbr_add(dbr, cfg_rrset.cr_ident, names, - cfg_rrset.cr_shared); - assert(dr != NULL); dprintf(DEBUG_CFGPARSE, "rrset resources"); TAILQ_FOREACH(cs, &cfg_rrset.cr_res, cs_next) { @@ -268,14 +261,16 @@ csd->csd_data, ttl); if (csd->csd_auto) { - dbr_res_add(dr, cs->cs_type, ttl, + dbr_res_add(dbr, cfg_rrset.cr_ident, + mdns_c_in, cs->cs_type, ttl, csd->csd_data, 1); } else { len = strlen(csd->csd_data) + 1; wp = malloc(len * sizeof(wchar_t)); mbstowcs(wp, csd->csd_data, len); - dbr_res_add(dr, cs->cs_type, ttl, + dbr_res_add(dbr, cfg_rrset.cr_ident, + mdns_c_in, cs->cs_type, ttl, wp, 0); } }
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200708051847.l75IlAwp041530>