On Wed, May 23, 2012 at 11:23 AM, Tom Browder <[email protected]> wrote:
...
> I envision them like this:

On more thought, maybe slightly different versions (size_t and char
inputs, int returns):

int
bu_vls_readc(struct bu_vls *vp, const size_t pos)
{
    BU_CK_VLS(vp);

    /* error to request past ending char */
    if (pos >= vp->vls_len)
        return -1;
    else
      return (int)vp->vls_str[vp->vls_offset + pos];
}

int
bu_vls_exchc(struct bu_vls *vp, const size_t pos, const char c)
{
    BU_CK_VLS(vp);

    /* error to request past ending char */
    if (pos >= vp->vls_len)
        return -1;
    else {
      vp->vls_str[vp->vls_offset + vp->pos] = c;
      /* allow the caller to check for proper handling */
      return (int)vp->vls_str[vp->vls_offset + vp->pos];
    }
}

-Tom

------------------------------------------------------------------------------
Live Security Virtual Conference
Exclusive live event will cover all the ways today's security and 
threat landscape has changed and how IT managers can respond. Discussions 
will include endpoint security, mobile security and the latest in malware 
threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
_______________________________________________
BRL-CAD Developer mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/brlcad-devel

Reply via email to