On Thu, Mar 06, 2014 at 07:40:56PM +0100, Patrice Clement wrote:
> ---
>  libavutil/dict.c | 53 +++++++++++++++++++++++++++++++----------------------
>  1 file changed, 31 insertions(+), 22 deletions(-)

dict: K&R formatting cosmetics

> --- a/libavutil/dict.c
> +++ b/libavutil/dict.c
> @@ -32,43 +32,51 @@ struct AVDictionary {
>  
>  int av_dict_count(const AVDictionary *m)
>  {
> -    return m ? m->count : 0;
> +    return m
> +           ? m->count
> +           : 0;

Leave such lines as-is.

> -AVDictionaryEntry *
> -av_dict_get(AVDictionary *m, const char *key, const AVDictionaryEntry *prev, 
> int flags)
> +AVDictionaryEntry *av_dict_get(AVDictionary *m, const char *key,
> +                               const AVDictionaryEntry *prev,
> +                               int flags)

This fits in two lines.

> -    for(; i<m->count; i++){
> -        const char *s= m->elems[i].key;
> -        if(flags & AV_DICT_MATCH_CASE) for(j=0;         s[j]  ==         
> key[j]  && key[j]; j++);
> -        else                               for(j=0; av_toupper(s[j]) == 
> av_toupper(key[j]) && key[j]; j++);
> -        if(key[j])

Gosh, this was ugly before.

> +    for (; i < m->count; i++) {
> +        const char *s = m->elems[i].key;
> +        if (flags & AV_DICT_MATCH_CASE)
> +            for (j = 0; s[j] == key[j] && key[j]; j++) ;
> +        else
> +            for (j = 0; av_toupper(s[j]) == av_toupper(key[j]) && key[j]; 
> j++) ;

Move the ; to the next line so that it becomes clear that the for-block
is empty.

> -    AVDictionary      *m = *pm;
> +    AVDictionary *m        = *pm;
>      AVDictionaryEntry *tag = av_dict_get(m, key, NULL, flags);
> -    char *oldval = NULL;
> +    char *oldval           = NULL;

These assignments are not related so I'd refrain from aligning them.

I'll fix these issues and push the patch tomorrow or so.

Diego
_______________________________________________
libav-devel mailing list
[email protected]
https://lists.libav.org/mailman/listinfo/libav-devel

Reply via email to