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

Thierry Reding thierry.reding at gmail.com
Wed Dec 21 14:15:30 UTC 2016


On Wed, Dec 21, 2016 at 08:49:18AM -0500, Ilia Mirkin wrote:
> 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...

I'm sure there are ways to do that, I was merely following what was
already being done in other files.

And yes, this isn't optimal, but neither is having each author add their
own indentation style to the files.

Solutions that I've found that do this per directory aren't very optimal
either because you'd still need one file per editor and per directory,
and they all require manual intervention to activate. Most are insecure
to the point where I wouldn't want to enable them.

Thierry

> 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 --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 833 bytes
Desc: not available
URL: <https://lists.freedesktop.org/archives/mesa-dev/attachments/20161221/414b8626/attachment.sig>


More information about the mesa-dev mailing list