From dec57e5796ac3cd6a9a542117d5bf0a13a9d4273 Mon Sep 17 00:00:00 2001 From: "Enrico Weigelt, metux IT consult" Date: Fri, 10 May 2024 11:15:20 +0200 Subject: [PATCH] treewide: replace xnfstrdup() calls by XNFstrdup() This has been nothing but an alias for two decades now (somewhere in R6.6), so there doesn't seem to be any practical need for this indirection. The macro still needs to remain, as long as (external) drivers still using it. Signed-off-by: Enrico Weigelt, metux IT consult Part-of: --- glamor/glamor.c | 2 +- glx/glxdri2.c | 2 +- hw/xfree86/common/xf86AutoConfig.c | 6 ++--- hw/xfree86/common/xf86Config.c | 8 +++--- hw/xfree86/common/xf86Configure.c | 42 +++++++++++++++--------------- hw/xfree86/common/xf86Mode.c | 6 ++--- hw/xfree86/common/xf86sbusBus.c | 2 +- hw/xfree86/modes/xf86Modes.c | 2 +- test/input.c | 10 +++---- test/touch.c | 10 +++---- xkb/ddxLoad.c | 2 +- xkb/xkbInit.c | 10 +++---- 12 files changed, 51 insertions(+), 51 deletions(-) diff --git a/glamor/glamor.c b/glamor/glamor.c index 70a34d81b..914c414a1 100644 --- a/glamor/glamor.c +++ b/glamor/glamor.c @@ -954,7 +954,7 @@ glamor_set_glvnd_vendor(ScreenPtr screen, const char *vendor_name) if (glamor_priv->glvnd_vendor) free(glamor_priv->glvnd_vendor); - glamor_priv->glvnd_vendor = xnfstrdup(vendor_name); + glamor_priv->glvnd_vendor = XNFstrdup(vendor_name); } const char * diff --git a/glx/glxdri2.c b/glx/glxdri2.c index 2321be922..bb557fb7d 100644 --- a/glx/glxdri2.c +++ b/glx/glxdri2.c @@ -982,7 +982,7 @@ __glXDRIscreenProbe(ScreenPtr pScreen) xf86ProcessOptions(pScrn->scrnIndex, pScrn->options, options); glvnd = xf86GetOptValString(options, GLXOPT_VENDOR_LIBRARY); if (glvnd) - screen->base.glvnd = xnfstrdup(glvnd); + screen->base.glvnd = XNFstrdup(glvnd); free(options); if (!screen->base.glvnd) diff --git a/hw/xfree86/common/xf86AutoConfig.c b/hw/xfree86/common/xf86AutoConfig.c index a63b53676..d49f59085 100644 --- a/hw/xfree86/common/xf86AutoConfig.c +++ b/hw/xfree86/common/xf86AutoConfig.c @@ -104,7 +104,7 @@ AppendToList(const char *s, const char ***list, int *lines) { char *str, *newstr, *p; - str = xnfstrdup(s); + str = XNFstrdup(s); for (p = strtok(str, "\n"); p; p = strtok(NULL, "\n")) { (*lines)++; *list = XNFreallocarray(*list, *lines + 1, sizeof(**list)); @@ -156,7 +156,7 @@ xf86AddMatchedDriver(XF86MatchedDrivers *md, const char *driver) } if (nmatches < MATCH_DRIVERS_LIMIT) { - md->matches[nmatches] = xnfstrdup(driver); + md->matches[nmatches] = XNFstrdup(driver); md->nmatches++; } else { @@ -272,7 +272,7 @@ listPossibleVideoDrivers(XF86MatchedDrivers *md) /* find end of all uppercase vendor section */ } if ((cp != visid.name) && (*cp != '\0')) { - char *vendorName = xnfstrdup(visid.name); + char *vendorName = XNFstrdup(visid.name); vendorName[cp - visid.name] = '\0'; diff --git a/hw/xfree86/common/xf86Config.c b/hw/xfree86/common/xf86Config.c index c3e77350f..fce7c401d 100644 --- a/hw/xfree86/common/xf86Config.c +++ b/hw/xfree86/common/xf86Config.c @@ -556,7 +556,7 @@ configFiles(XF86ConfFilesPtr fileconf) temp_path = defaultFontPath ? (char *) defaultFontPath : (char *) ""; /* xf86ValidateFontPath modifies its argument, but returns a copy of it. */ - temp_path = must_copy ? xnfstrdup(defaultFontPath) : (char *) defaultFontPath; + temp_path = must_copy ? XNFstrdup(defaultFontPath) : (char *) defaultFontPath; defaultFontPath = xf86ValidateFontPath(temp_path); free(temp_path); @@ -1950,7 +1950,7 @@ configMonitor(MonPtr monitorp, XF86ConfMonitorPtr conf_monitor) mode->Flags = cmodep->ml_flags; mode->HSkew = cmodep->ml_hskew; mode->VScan = cmodep->ml_vscan; - mode->name = xnfstrdup(cmodep->ml_identifier); + mode->name = XNFstrdup(cmodep->ml_identifier); if (last) { mode->prev = last; last->next = mode; @@ -2347,7 +2347,7 @@ xf86HandleConfigFile(Bool autoconfig) filename = xf86openConfigFile(filesearch, xf86ConfigFile, PROJECTROOT); if (filename) { xf86MsgVerb(filefrom, 0, "Using config file: \"%s\"\n", filename); - xf86ConfigFile = xnfstrdup(filename); + xf86ConfigFile = XNFstrdup(filename); } else { if (xf86ConfigFile) @@ -2357,7 +2357,7 @@ xf86HandleConfigFile(Bool autoconfig) if (dirname) { xf86MsgVerb(dirfrom, 0, "Using config directory: \"%s\"\n", dirname); - xf86ConfigDir = xnfstrdup(dirname); + xf86ConfigDir = XNFstrdup(dirname); } else { if (xf86ConfigDir) diff --git a/hw/xfree86/common/xf86Configure.c b/hw/xfree86/common/xf86Configure.c index 24602a879..052794efe 100644 --- a/hw/xfree86/common/xf86Configure.c +++ b/hw/xfree86/common/xf86Configure.c @@ -165,8 +165,8 @@ configureInputSection(void) parsePrologue(XF86ConfInputPtr, XF86ConfInputRec); - ptr->inp_identifier = xnfstrdup("Keyboard0"); - ptr->inp_driver = xnfstrdup("kbd"); + ptr->inp_identifier = XNFstrdup("Keyboard0"); + ptr->inp_driver = XNFstrdup("kbd"); ptr->list.next = NULL; /* Crude mechanism to auto-detect mouse (os dependent) */ @@ -181,17 +181,17 @@ configureInputSection(void) } mouse = calloc(1, sizeof(XF86ConfInputRec)); - mouse->inp_identifier = xnfstrdup("Mouse0"); - mouse->inp_driver = xnfstrdup("mouse"); + mouse->inp_identifier = XNFstrdup("Mouse0"); + mouse->inp_driver = XNFstrdup("mouse"); mouse->inp_option_lst = - xf86addNewOption(mouse->inp_option_lst, xnfstrdup("Protocol"), - xnfstrdup(DFLT_MOUSE_PROTO)); + xf86addNewOption(mouse->inp_option_lst, XNFstrdup("Protocol"), + XNFstrdup(DFLT_MOUSE_PROTO)); mouse->inp_option_lst = - xf86addNewOption(mouse->inp_option_lst, xnfstrdup("Device"), - xnfstrdup(DFLT_MOUSE_DEV)); + xf86addNewOption(mouse->inp_option_lst, XNFstrdup("Device"), + XNFstrdup(DFLT_MOUSE_DEV)); mouse->inp_option_lst = - xf86addNewOption(mouse->inp_option_lst, xnfstrdup("ZAxisMapping"), - xnfstrdup("4 5 6 7")); + xf86addNewOption(mouse->inp_option_lst, XNFstrdup("ZAxisMapping"), + XNFstrdup("4 5 6 7")); ptr = (XF86ConfInputPtr) xf86addListItem((glp) ptr, (glp) mouse); return ptr; } @@ -294,7 +294,7 @@ configureDeviceSection(int screennum) " ### : \"String\", : \" Hz/kHz/MHz\",\n" " ### : \"%\"\n" " ### [arg]: arg optional\n"; - ptr->dev_comment = xnfstrdup(descrip); + ptr->dev_comment = XNFstrdup(descrip); if (ptr->dev_comment) { for (p = DevToConfig[screennum].GDev.options; p->name != NULL; p++) { char *p_e; @@ -341,9 +341,9 @@ configureLayoutSection(void) iptr = malloc(sizeof(XF86ConfInputrefRec)); iptr->list.next = NULL; iptr->iref_option_lst = NULL; - iptr->iref_inputdev_str = xnfstrdup("Mouse0"); + iptr->iref_inputdev_str = XNFstrdup("Mouse0"); iptr->iref_option_lst = - xf86addNewOption(iptr->iref_option_lst, xnfstrdup("CorePointer"), + xf86addNewOption(iptr->iref_option_lst, XNFstrdup("CorePointer"), NULL); ptr->lay_input_lst = (XF86ConfInputrefPtr) xf86addListItem((glp) ptr->lay_input_lst, (glp) iptr); @@ -355,9 +355,9 @@ configureLayoutSection(void) iptr = malloc(sizeof(XF86ConfInputrefRec)); iptr->list.next = NULL; iptr->iref_option_lst = NULL; - iptr->iref_inputdev_str = xnfstrdup("Keyboard0"); + iptr->iref_inputdev_str = XNFstrdup("Keyboard0"); iptr->iref_option_lst = - xf86addNewOption(iptr->iref_option_lst, xnfstrdup("CoreKeyboard"), + xf86addNewOption(iptr->iref_option_lst, XNFstrdup("CoreKeyboard"), NULL); ptr->lay_input_lst = (XF86ConfInputrefPtr) xf86addListItem((glp) ptr->lay_input_lst, (glp) iptr); @@ -429,9 +429,9 @@ configureFilesSection(void) parsePrologue(XF86ConfFilesPtr, XF86ConfFilesRec); if (xf86ModulePath) - ptr->file_modulepath = xnfstrdup(xf86ModulePath); + ptr->file_modulepath = XNFstrdup(xf86ModulePath); if (defaultFontPath) - ptr->file_fontpath = xnfstrdup(defaultFontPath); + ptr->file_fontpath = XNFstrdup(defaultFontPath); return ptr; } @@ -444,8 +444,8 @@ configureMonitorSection(int screennum) XNFasprintf(&tmp, "Monitor%d", screennum); ptr->mon_identifier = tmp; - ptr->mon_vendor = xnfstrdup("Monitor Vendor"); - ptr->mon_modelname = xnfstrdup("Monitor Model"); + ptr->mon_vendor = XNFstrdup("Monitor Vendor"); + ptr->mon_modelname = XNFstrdup("Monitor Model"); return ptr; } @@ -489,7 +489,7 @@ configureDDCMonitorSection(int screennum) XNFasprintf(&tmp, "Monitor%d", screennum); ptr->mon_identifier = tmp; - ptr->mon_vendor = xnfstrdup(ConfiguredMonitor->vendor.name); + ptr->mon_vendor = XNFstrdup(ConfiguredMonitor->vendor.name); XNFasprintf(&ptr->mon_modelname, "%x", ConfiguredMonitor->vendor.prod_id); /* features in centimetres, we want millimetres */ @@ -527,7 +527,7 @@ configureDDCMonitorSection(int screennum) if (ConfiguredMonitor->features.dpms) { ptr->mon_option_lst = - xf86addNewOption(ptr->mon_option_lst, xnfstrdup("DPMS"), NULL); + xf86addNewOption(ptr->mon_option_lst, XNFstrdup("DPMS"), NULL); } return ptr; diff --git a/hw/xfree86/common/xf86Mode.c b/hw/xfree86/common/xf86Mode.c index 1f2de02fb..b9cbcf54c 100644 --- a/hw/xfree86/common/xf86Mode.c +++ b/hw/xfree86/common/xf86Mode.c @@ -1585,7 +1585,7 @@ xf86ValidateModes(ScrnInfoPtr scrp, DisplayModePtr availModes, } new->prev = NULL; q = new; - q->name = xnfstrdup(p->name); + q->name = XNFstrdup(p->name); q->status = MODE_OK; } else { @@ -1618,7 +1618,7 @@ xf86ValidateModes(ScrnInfoPtr scrp, DisplayModePtr availModes, new = XNFcallocarray(1, sizeof(DisplayModeRec)); new->prev = last; new->type = M_T_USERDEF; - new->name = xnfstrdup(modeNames[i]); + new->name = XNFstrdup(modeNames[i]); if (new->prev) new->prev->next = new; *endp = last = new; @@ -1685,7 +1685,7 @@ xf86ValidateModes(ScrnInfoPtr scrp, DisplayModePtr availModes, p = XNFcallocarray(1, sizeof(DisplayModeRec)); p->prev = last; - p->name = xnfstrdup(r->name); + p->name = XNFstrdup(r->name); if (!userModes) p->type = M_T_USERDEF; if (p->prev) diff --git a/hw/xfree86/common/xf86sbusBus.c b/hw/xfree86/common/xf86sbusBus.c index 2af66b807..b7638a352 100644 --- a/hw/xfree86/common/xf86sbusBus.c +++ b/hw/xfree86/common/xf86sbusBus.c @@ -73,7 +73,7 @@ CheckSbusDevice(const char *device, int fbNum) xf86SbusInfo[xf86nSbusInfo - 1] = psdp = XNFcallocarray(1, sizeof(sbusDevice)); psdp->devId = sbusDeviceTable[i].devId; psdp->fbNum = fbNum; - psdp->device = xnfstrdup(device); + psdp->device = XNFstrdup(device); psdp->width = fbattr.fbtype.fb_width; psdp->height = fbattr.fbtype.fb_height; psdp->fd = -1; diff --git a/hw/xfree86/modes/xf86Modes.c b/hw/xfree86/modes/xf86Modes.c index b0cead26f..091ce6333 100644 --- a/hw/xfree86/modes/xf86Modes.c +++ b/hw/xfree86/modes/xf86Modes.c @@ -220,7 +220,7 @@ xf86DuplicateMode(const DisplayModeRec * pMode) if (pMode->name == NULL) xf86SetModeDefaultName(pNew); else - pNew->name = xnfstrdup(pMode->name); + pNew->name = XNFstrdup(pMode->name); return pNew; } diff --git a/test/input.c b/test/input.c index b0de20331..267d4b14e 100644 --- a/test/input.c +++ b/test/input.c @@ -1214,27 +1214,27 @@ dix_input_attributes(void) assert(memcmp(orig, new, sizeof(InputAttributes)) == 0); FreeInputAttributes(new); - orig->product = xnfstrdup("product name"); + orig->product = XNFstrdup("product name"); new = DuplicateInputAttributes(orig); cmp_attr_fields(orig, new); FreeInputAttributes(new); - orig->vendor = xnfstrdup("vendor name"); + orig->vendor = XNFstrdup("vendor name"); new = DuplicateInputAttributes(orig); cmp_attr_fields(orig, new); FreeInputAttributes(new); - orig->device = xnfstrdup("device path"); + orig->device = XNFstrdup("device path"); new = DuplicateInputAttributes(orig); cmp_attr_fields(orig, new); FreeInputAttributes(new); - orig->pnp_id = xnfstrdup("PnPID"); + orig->pnp_id = XNFstrdup("PnPID"); new = DuplicateInputAttributes(orig); cmp_attr_fields(orig, new); FreeInputAttributes(new); - orig->usb_id = xnfstrdup("USBID"); + orig->usb_id = XNFstrdup("USBID"); new = DuplicateInputAttributes(orig); cmp_attr_fields(orig, new); FreeInputAttributes(new); diff --git a/test/touch.c b/test/touch.c index e4d14f63d..dcd693326 100644 --- a/test/touch.c +++ b/test/touch.c @@ -62,7 +62,7 @@ touch_grow_queue(void) memset(&dev, 0, sizeof(dev)); dev.type = MASTER_POINTER; /* claim it's a master to stop ptracccel */ - dev.name = xnfstrdup("test device"); + dev.name = XNFstrdup("test device"); dev.id = 2; InitValuatorClassDeviceStruct(&dev, 2, labels, 10, Absolute); @@ -128,7 +128,7 @@ touch_find_ddxid(void) memset(&dev, 0, sizeof(dev)); dev.type = MASTER_POINTER; /* claim it's a master to stop ptracccel */ - dev.name = xnfstrdup("test device"); + dev.name = XNFstrdup("test device"); dev.id = 2; InitValuatorClassDeviceStruct(&dev, 2, labels, 10, Absolute); @@ -202,7 +202,7 @@ touch_begin_ddxtouch(void) memset(&dev, 0, sizeof(dev)); dev.type = MASTER_POINTER; /* claim it's a master to stop ptracccel */ - dev.name = xnfstrdup("test device"); + dev.name = XNFstrdup("test device"); dev.id = 2; inputInfo.devices = &dev; @@ -252,7 +252,7 @@ touch_begin_touch(void) memset(&dev, 0, sizeof(dev)); dev.type = MASTER_POINTER; /* claim it's a master to stop ptracccel */ - dev.name = xnfstrdup("test device"); + dev.name = XNFstrdup("test device"); dev.id = 2; ti = TouchBeginTouch(&dev, sourceid, touchid, TRUE); @@ -289,7 +289,7 @@ touch_init(void) memset(&dev, 0, sizeof(dev)); dev.type = MASTER_POINTER; /* claim it's a master to stop ptracccel */ - dev.name = xnfstrdup("test device"); + dev.name = XNFstrdup("test device"); memset(&sprite, 0, sizeof(sprite)); dev.spriteInfo = &sprite; diff --git a/xkb/ddxLoad.c b/xkb/ddxLoad.c index 3aafab90e..abf213970 100644 --- a/xkb/ddxLoad.c +++ b/xkb/ddxLoad.c @@ -193,7 +193,7 @@ RunXkbComp(xkbcomp_buffer_callback callback, void *userdata) #ifdef WIN32 unlink(tmpname); #endif - return xnfstrdup(keymap); + return XNFstrdup(keymap); } else { LogMessage(X_ERROR, "Error compiling keymap (%s) executing '%s'\n", diff --git a/xkb/xkbInit.c b/xkb/xkbInit.c index a9c5bbf71..a45fba6f6 100644 --- a/xkb/xkbInit.c +++ b/xkb/xkbInit.c @@ -208,11 +208,11 @@ XkbInitRules(XkbRMLVOSet *rmlvo, const char *variant, const char *options) { - rmlvo->rules = rules ? xnfstrdup(rules) : NULL; - rmlvo->model = model ? xnfstrdup(model) : NULL; - rmlvo->layout = layout ? xnfstrdup(layout) : NULL; - rmlvo->variant = variant ? xnfstrdup(variant) : NULL; - rmlvo->options = options ? xnfstrdup(options) : NULL; + rmlvo->rules = rules ? XNFstrdup(rules) : NULL; + rmlvo->model = model ? XNFstrdup(model) : NULL; + rmlvo->layout = layout ? XNFstrdup(layout) : NULL; + rmlvo->variant = variant ? XNFstrdup(variant) : NULL; + rmlvo->options = options ? XNFstrdup(options) : NULL; } static void