mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2024-11-22 15:40:19 +00:00
AK: Remove unused TemporaryFile class.
This commit is contained in:
parent
ce5d21ea19
commit
ab6bd3872b
Notes:
sideshowbarker
2024-07-19 14:50:29 +09:00
Author: https://github.com/awesomekling Commit: https://github.com/SerenityOS/serenity/commit/ab6bd3872bd
2 changed files with 0 additions and 59 deletions
|
@ -1,33 +0,0 @@
|
|||
#include "TemporaryFile.h"
|
||||
#include <fcntl.h>
|
||||
#include <stdlib.h>
|
||||
#include <unistd.h>
|
||||
|
||||
namespace AK {
|
||||
|
||||
TemporaryFile::TemporaryFile()
|
||||
{
|
||||
char nameBuffer[] = "/tmp/AKTemporaryFile.XXXXXX";
|
||||
int fd = mkstemp(nameBuffer);
|
||||
if (fd != -1) {
|
||||
m_stream = fdopen(fd, "w+");
|
||||
m_file_name = nameBuffer;
|
||||
}
|
||||
}
|
||||
|
||||
TemporaryFile::~TemporaryFile()
|
||||
{
|
||||
if (is_valid()) {
|
||||
unlink(m_file_name.characters());
|
||||
fclose(m_stream);
|
||||
}
|
||||
}
|
||||
|
||||
void TemporaryFile::sync()
|
||||
{
|
||||
if (m_stream)
|
||||
fflush(m_stream);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -1,26 +0,0 @@
|
|||
#pragma once
|
||||
|
||||
#include "AKString.h"
|
||||
#include <stdio.h>
|
||||
|
||||
namespace AK {
|
||||
|
||||
class TemporaryFile {
|
||||
public:
|
||||
TemporaryFile();
|
||||
~TemporaryFile();
|
||||
|
||||
bool is_valid() const { return m_stream; }
|
||||
FILE* stream() { return m_stream; }
|
||||
String file_name() const { return m_file_name; }
|
||||
void sync();
|
||||
|
||||
private:
|
||||
FILE* m_stream { nullptr };
|
||||
String m_file_name;
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
using AK::TemporaryFile;
|
||||
|
Loading…
Reference in a new issue