AutoDeleteArray -> std::unique_ptr
Also, switch to C++14 for std::make_unique.
This commit is contained in:
		
							parent
							
								
									40dfac968a
								
							
						
					
					
						commit
						2b9d0a99cb
					
				
					 5 changed files with 10 additions and 24 deletions
				
			
		|  | @ -272,11 +272,10 @@ string readFile(int fd) | |||
|     if (fstat(fd, &st) == -1) | ||||
|         throw SysError("statting file"); | ||||
| 
 | ||||
|     unsigned char * buf = new unsigned char[st.st_size]; | ||||
|     AutoDeleteArray<unsigned char> d(buf); | ||||
|     readFull(fd, buf, st.st_size); | ||||
|     auto buf = std::make_unique<unsigned char[]>(st.st_size); | ||||
|     readFull(fd, buf.get(), st.st_size); | ||||
| 
 | ||||
|     return string((char *) buf, st.st_size); | ||||
|     return string((char *) buf.get(), st.st_size); | ||||
| } | ||||
| 
 | ||||
| 
 | ||||
|  |  | |||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue