[SSSD] [PATCH] AD: Rename parametrized #define

Jakub Hrozek jhrozek at redhat.com
Wed Sep 4 08:11:07 UTC 2013


This is a real nitpick, but I think any string constants that contain a
printf-like format specifier should be named so that their name include
FMT, TMPL or similar to minimize the rist of being used in a wrong way.
-------------- next part --------------
>From 11ce916a6f6734cb69a07da3dc76b6c372557b2b Mon Sep 17 00:00:00 2001
From: Jakub Hrozek <jhrozek at redhat.com>
Date: Wed, 4 Sep 2013 09:53:05 +0200
Subject: [PATCH] AD: Rename parametrized #define

---
 src/providers/ad/ad_srv.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/src/providers/ad/ad_srv.c b/src/providers/ad/ad_srv.c
index af25c10728ea047655013ee474934ed280236aa6..3d545c43af01ad67cfc1c12b8cef4b3b79ecff37 100644
--- a/src/providers/ad/ad_srv.c
+++ b/src/providers/ad/ad_srv.c
@@ -33,7 +33,7 @@
 #include "providers/ldap/sdap.h"
 #include "providers/ldap/sdap_async.h"
 
-#define AD_SITE_DOMAIN "%s._sites.%s"
+#define AD_SITE_DOMAIN_FMT "%s._sites.%s"
 #define AD_AT_DNS_DOMAIN "DnsDomain"
 #define AD_AT_NT_VERSION "NtVer"
 #define AD_AT_NETLOGON "netlogon"
@@ -759,7 +759,7 @@ static void ad_srv_plugin_site_done(struct tevent_req *subreq)
     talloc_zfree(subreq);
     if (ret == EOK) {
         if (strcmp(state->service, "gc") == 0) {
-            primary_domain = talloc_asprintf(state, AD_SITE_DOMAIN,
+            primary_domain = talloc_asprintf(state, AD_SITE_DOMAIN_FMT,
                                              state->site, state->forest);
             if (primary_domain == NULL) {
                 ret = ENOMEM;
@@ -768,7 +768,7 @@ static void ad_srv_plugin_site_done(struct tevent_req *subreq)
 
             backup_domain = state->forest;
         } else {
-            primary_domain = talloc_asprintf(state, AD_SITE_DOMAIN,
+            primary_domain = talloc_asprintf(state, AD_SITE_DOMAIN_FMT,
                                              state->site, state->discovery_domain);
             if (primary_domain == NULL) {
                 ret = ENOMEM;
-- 
1.8.3.1



More information about the sssd-devel mailing list