[Mesa-dev] [PATCH] loader: Add vim modeline

Ilia Mirkin imirkin at alum.mit.edu
Wed Dec 21 13:49:18 UTC 2016


So you want every file to have a modeline for every editor? Is there no way
to do this at the directory level, like you can with emacs? I thought there
was some editorconfig thing...

On Dec 21, 2016 8:44 AM, "Thierry Reding" <thierry.reding at gmail.com> wrote:

From: Thierry Reding <treding at nvidia.com>

Add a vim modeline that defines the identation style used in this file.
This is useful to avoid vim's defaults (8-column tabs) from getting in
the way.

While at it, fix up a few cases where inconsistent indentation is used.

Signed-off-by: Thierry Reding <treding at nvidia.com>
---
 src/loader/loader.c | 28 +++++++++++++++-------------
 1 file changed, 15 insertions(+), 13 deletions(-)

diff --git a/src/loader/loader.c b/src/loader/loader.c
index 449ff54d1377..eb536ac970f9 100644
--- a/src/loader/loader.c
+++ b/src/loader/loader.c
@@ -86,9 +86,9 @@ loader_open_device(const char *device_name)
 #ifdef USE_DRICONF
 static const char __driConfigOptionsLoader[] =
 DRI_CONF_BEGIN
-    DRI_CONF_SECTION_INITIALIZATION
-        DRI_CONF_DEVICE_ID_PATH_TAG()
-    DRI_CONF_SECTION_END
+   DRI_CONF_SECTION_INITIALIZATION
+      DRI_CONF_DEVICE_ID_PATH_TAG()
+   DRI_CONF_SECTION_END
 DRI_CONF_END;

 static char *loader_get_dri_config_device_id(void)
@@ -115,13 +115,13 @@ static char *drm_construct_id_path_tag(drmDevicePtr
device)
    char *tag = NULL;

    if (device->bustype == DRM_BUS_PCI) {
-        tag = calloc(PCI_ID_PATH_TAG_LENGTH, sizeof(char));
-        if (tag == NULL)
-            return NULL;
+      tag = calloc(PCI_ID_PATH_TAG_LENGTH, sizeof(char));
+      if (tag == NULL)
+         return NULL;

-        snprintf(tag, PCI_ID_PATH_TAG_LENGTH, "pci-%04x_%02x_%02x_%1u",
-                 device->businfo.pci->domain, device->businfo.pci->bus,
-                 device->businfo.pci->dev, device->businfo.pci->func);
+      snprintf(tag, PCI_ID_PATH_TAG_LENGTH, "pci-%04x_%02x_%02x_%1u",
+               device->businfo.pci->domain, device->businfo.pci->bus,
+               device->businfo.pci->dev, device->businfo.pci->func);
    }
    return tag;
 }
@@ -386,8 +386,8 @@ loader_get_driver_for_fd(int fd)

 out:
    log_(driver ? _LOADER_DEBUG : _LOADER_WARNING,
-         "pci id for fd %d: %04x:%04x, driver %s\n",
-         fd, vendor_id, chip_id, driver);
+        "pci id for fd %d: %04x:%04x, driver %s\n",
+        fd, vendor_id, chip_id, driver);
    return driver;
 }

@@ -415,9 +415,11 @@ loader_get_extensions_name(const char *driver_name)

    const size_t len = strlen(name);
    for (size_t i = 0; i < len; i++) {
-          if (name[i] == '-')
-                  name[i] = '_';
+      if (name[i] == '-')
+         name[i] = '_';
    }

    return name;
 }
+
+/* vim: set et sts=3 sw=3 ts=3: */
--
2.11.0

_______________________________________________
mesa-dev mailing list
mesa-dev at lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/mesa-dev
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.freedesktop.org/archives/mesa-dev/attachments/20161221/697079bd/attachment.html>


More information about the mesa-dev mailing list