comparison src/fileio.c @ 1726:a8d8f419b459

[xemacs-hg @ 2003-09-30 15:26:34 by james] Add type information to xfree to avoid alias creation.
author james
date Tue, 30 Sep 2003 15:27:01 +0000
parents 1b0339b048ce
children 04bc9d2f42c7
comparison
equal deleted inserted replaced
1725:7ff8f4d70aec 1726:a8d8f419b459
390 qxestrcat (res, (Ibyte *) "/"); 390 qxestrcat (res, (Ibyte *) "/");
391 beg = res; 391 beg = res;
392 p = beg + qxestrlen (beg); 392 p = beg + qxestrlen (beg);
393 } 393 }
394 if (wd) 394 if (wd)
395 xfree (wd); 395 xfree (wd, Ibyte *);
396 } 396 }
397 397
398 #if 0 /* No! This screws up efs, which calls file-name-directory on URL's 398 #if 0 /* No! This screws up efs, which calls file-name-directory on URL's
399 and expects the slashes to be left alone. This is here because of 399 and expects the slashes to be left alone. This is here because of
400 an analogous call in FSF 21. */ 400 an analogous call in FSF 21. */
401 { 401 {
402 Bytecount len = p - beg; 402 Bytecount len = p - beg;
403 Ibyte *newbeg = alloca_ibytes (len + 1); 403 Ibyte *newbeg = alloca_ibytes (len + 1);
404 Lisp_Object return_me;
405 404
406 qxestrncpy (newbeg, beg, len); 405 qxestrncpy (newbeg, beg, len);
407 newbeg[len] = '\0'; 406 newbeg[len] = '\0';
408 newbeg = mswindows_canonicalize_filename (newbeg); 407 newbeg = mswindows_canonicalize_filename (newbeg);
409 return_me = build_intstring (newbeg); 408 return build_intstring (newbeg);
410 xfree (newbeg);
411 return return_me;
412 } 409 }
413 #endif 410 #endif
414 #endif /* not WIN32_NATIVE */ 411 #endif /* not WIN32_NATIVE */
415 return make_string (beg, p - beg); 412 return make_string (beg, p - beg);
416 } 413 }
928 name = build_intstring (newnm); 925 name = build_intstring (newnm);
929 XSTRING_DATA (name)[0] = DRIVE_LETTER (drive); 926 XSTRING_DATA (name)[0] = DRIVE_LETTER (drive);
930 XSTRING_DATA (name)[1] = ':'; 927 XSTRING_DATA (name)[1] = ':';
931 } 928 }
932 } 929 }
933 xfree (newnm); 930 xfree (newnm, Ibyte *);
934 RETURN_UNGCPRO (name); 931 RETURN_UNGCPRO (name);
935 } 932 }
936 #endif /* WIN32_FILENAMES */ 933 #endif /* WIN32_FILENAMES */
937 #ifndef WIN32_NATIVE 934 #ifndef WIN32_NATIVE
938 if (nm == XSTRING_DATA (name)) 935 if (nm == XSTRING_DATA (name))
1040 { 1037 {
1041 Ibyte *newcwd = mswindows_getdcwd (toupper (drive) - 'A' + 1); 1038 Ibyte *newcwd = mswindows_getdcwd (toupper (drive) - 'A' + 1);
1042 if (newcwd) 1039 if (newcwd)
1043 { 1040 {
1044 IBYTE_STRING_TO_ALLOCA (newcwd, newdir); 1041 IBYTE_STRING_TO_ALLOCA (newcwd, newdir);
1045 xfree (newcwd); 1042 xfree (newcwd, Ibyte *);
1046 } 1043 }
1047 else 1044 else
1048 newdir = NULL; 1045 newdir = NULL;
1049 } 1046 }
1050 #endif /* WIN32_NATIVE */ 1047 #endif /* WIN32_NATIVE */
1126 #ifdef WIN32_NATIVE 1123 #ifdef WIN32_NATIVE
1127 Ibyte *newcwd = mswindows_getdcwd (toupper (drive) - 'A' + 1); 1124 Ibyte *newcwd = mswindows_getdcwd (toupper (drive) - 'A' + 1);
1128 if (newcwd) 1125 if (newcwd)
1129 { 1126 {
1130 IBYTE_STRING_TO_ALLOCA (newcwd, newdir); 1127 IBYTE_STRING_TO_ALLOCA (newcwd, newdir);
1131 xfree (newcwd); 1128 xfree (newcwd, Ibyte *);
1132 } 1129 }
1133 else 1130 else
1134 #endif 1131 #endif
1135 IBYTE_STRING_TO_ALLOCA ((Ibyte *) "/", newdir); 1132 IBYTE_STRING_TO_ALLOCA ((Ibyte *) "/", newdir);
1136 } 1133 }
1302 *o = '\0'; 1299 *o = '\0';
1303 1300
1304 { 1301 {
1305 Ibyte *newtarget = mswindows_canonicalize_filename (target); 1302 Ibyte *newtarget = mswindows_canonicalize_filename (target);
1306 Lisp_Object result = build_intstring (newtarget); 1303 Lisp_Object result = build_intstring (newtarget);
1307 xfree (newtarget); 1304 xfree (newtarget, Ibyte *);
1308 1305
1309 RETURN_UNGCPRO (result); 1306 RETURN_UNGCPRO (result);
1310 } 1307 }
1311 #else /* not WIN32_FILENAMES */ 1308 #else /* not WIN32_FILENAMES */
1312 RETURN_UNGCPRO (make_string (target, o - target)); 1309 RETURN_UNGCPRO (make_string (target, o - target));
2434 buf = xnew_array_and_zero (Ibyte, bufsize); 2431 buf = xnew_array_and_zero (Ibyte, bufsize);
2435 valsize = qxe_readlink (XSTRING_DATA (filename), 2432 valsize = qxe_readlink (XSTRING_DATA (filename),
2436 buf, bufsize); 2433 buf, bufsize);
2437 if (valsize < bufsize) break; 2434 if (valsize < bufsize) break;
2438 /* Buffer was not long enough */ 2435 /* Buffer was not long enough */
2439 xfree (buf); 2436 xfree (buf, Ibyte *);
2440 bufsize *= 2; 2437 bufsize *= 2;
2441 } 2438 }
2442 if (valsize == -1) 2439 if (valsize == -1)
2443 { 2440 {
2444 xfree (buf); 2441 xfree (buf, Ibyte *);
2445 return Qnil; 2442 return Qnil;
2446 } 2443 }
2447 val = make_string (buf, valsize); 2444 val = make_string (buf, valsize);
2448 xfree (buf); 2445 xfree (buf, Ibyte *);
2449 return val; 2446 return val;
2450 #else /* not HAVE_READLINK */ 2447 #else /* not HAVE_READLINK */
2451 return Qnil; 2448 return Qnil;
2452 #endif /* not HAVE_READLINK */ 2449 #endif /* not HAVE_READLINK */
2453 } 2450 }