[xml] Coding conventions?



I'm wondering if there's any standard coding convention/indent settings
that are applied to the source for this project. If so, is there a link
I could refer to to find out what they are? If not, am I free to
reformat code as I go and submit patches to clean things up?


Thanks,

-- Travis

Example 1: Tabs/goofy indentation (xmlschemas.c:2086)
           Soft tabs are your friend :)

    if (name == NULL) {

        ref = xmlGetQNameProp(ctxt, node, "ref", &refNs);
        if (ref == NULL) {
            xmlSchemaPErr2(ctxt, node, child,
                           XML_SCHEMAP_ATTRGRP_NONAME_NOREF,
                           "AttributeGroup has no name nor ref\n", NULL,
                           NULL);
            return (NULL);
        }
        if (refNs == NULL) // *** Tab 1 (assumes a tab-stop of 8)
            refNs = schema->targetNamespace; // *** Tab 2 (also TS 8)
        snprintf(buf, 99, "anonattrgroup %d", ctxt->counter++ + 1);
        name = (const xmlChar *) buf;
        if (name == NULL) {
            xmlSchemaPErrMemory(ctxt, "creating attribute group", node);
            return (NULL);
        }
    }


Example 2: Ugly/confusing syntax (xmlscemas.c:2088) (generic version)
           this particular one is all over the place...

        foo (ctxt->counter++ + 1);

IMHO, this seems much cleaner (and is exactly why preincrement exists):

        foo ( ++(ctxt->counter) );

or even

        ctxt->counter++;
        foo (ctxt->counter);




[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]