3 Copyright 2008 Red Hat, Inc.
5 This software is a copyrighted work licensed under the terms of the
6 Cygwin license. Please consult the file "CYGWIN_LICENSE" for
14 #define tls_pbuf _my_tls.locals.pathbufs
17 tls_pathbuf::destroy ()
19 for (int i = 0; i < TP_NUM_C_BUFS; ++i)
22 for (int i = 0; i < TP_NUM_W_BUFS; ++i)
27 tmp_pathbuf::tmp_pathbuf ()
28 : c_buf_old (tls_pbuf.c_cnt),
29 w_buf_old (tls_pbuf.w_cnt)
32 tmp_pathbuf::~tmp_pathbuf ()
34 tls_pbuf.c_cnt = c_buf_old;
35 tls_pbuf.w_cnt = w_buf_old;
41 if (tls_pbuf.c_cnt >= TP_NUM_C_BUFS)
42 api_fatal ("Internal error: TP_NUM_C_BUFS too small.");
43 if (!tls_pbuf.c_buf[tls_pbuf.c_cnt]
44 && !(tls_pbuf.c_buf[tls_pbuf.c_cnt] = (char *) malloc (NT_MAX_PATH)))
45 api_fatal ("Internal error: Out of memory for new path buf.");
46 return tls_pbuf.c_buf[tls_pbuf.c_cnt++];
52 if (tls_pbuf.w_cnt >= TP_NUM_W_BUFS)
53 api_fatal ("Internal error: TP_NUM_W_BUFS too small.");
54 if (!tls_pbuf.w_buf[tls_pbuf.w_cnt]
55 && !(tls_pbuf.w_buf[tls_pbuf.w_cnt]
56 = (PWCHAR) malloc (NT_MAX_PATH * sizeof (WCHAR))))
57 api_fatal ("Internal error: Out of memory for new wide path buf.");
58 return tls_pbuf.w_buf[tls_pbuf.w_cnt++];