Where do you mean use writeStringToMemory, I'm guessing that you mean at lines 7680-7682? e.g.
    for (var i = 0; i < msg.length; i++) {
      {{{ makeSetValue('_gai_strerror.buffer', 'i', 'msg.charCodeAt(i)', 'i8') }}}
    }

The reason it's done this way is because I copied what strerror_r is doing (3979-3981) e.g.
        for (var i = 0; i < msg.length; i++) {
          {{{ makeSetValue('strerrbuf', 'i', 'msg.charCodeAt(i)', 'i8') }}}
        }

It seemed reasonable for gai_strerror to behave similarly to strerror. Are you suggesting that strerror is probably not right either? I'm guessing if that's the case it's cause strerror was written before writeStringToMemory.

Just curious really I'm keen to try and be consistent.

So should 7680-7682 read something like?:
writeStringToMemory(msg, _gai_strerror.buffer);